PayPlay.FM development.log

Tuesday, February 10, 2009

what is Rails now?

I thought about this post long ago, but yesterday found great similar post by Josh Susser.

I started writing rails sites about four years ago. It was something like 0.12 version and I still have CHANGELOG file in RAILS_ROOT of my first working rails site. I don't mean I am a guru/old-school hacker- I'm not. I just want to say that I can see difference between Rails start and where it is now.

Rails was simple and it was its most promoted feature - you could watch screencast, read couple of brochures like "rails in 4 days" and that was all - you were able to begin working with rails. Even without seeing ruby before.

Remember picture with pack of java books against two rails manuals? Many things changed since then.

Now to start new rails app, lots of decisions need to be taken: choose template engine, choose testing suite, choose ORM, choose javascript library. Rails became a skyscraper where every stage can be different. With Rails 3.0, when merb is merged in, things will be even more complicated.

You can't specify application environment just by calling it Rails. From now you need to clarify what your Rails is (haml,mocha,datamapper,prototype) or (sequel,erb,rspec,jquery) or whatever else you want to use.

Yes, you can use default options. But you still need to know other options if you want to be competitive. I think this 'flexibility' might be scary for beginners - there are too many options, too many ways of doing similar things.

I don't want to say that freedom of choice is bad thing. I just think rails is too fragmentized now. Maybe it is growth problem and it will be solved in future with something like common interfaces or by abandoning some technologies.

Labels: ,

Monday, January 19, 2009

mediatemple: mtr start

If you see messages like this

"application started, but pid file was not found, check 'mtr status' "

when doing mtr start/restart, it could be caused by several reasons: first, you need to read RAILS_ROOT/log/*, if it does not help - check your config/environment.rb for initializing RAILS_GEM_VERSION - rails version on (mt) can be different from your dev server.

Next thing to check is whether your gs-container is capable of working with your app. When you try to run several apps on default free 64M Container (and that was my case), the earliest process will be killed and you'll get no messages but this default 'pid was not found'.

Labels: , ,

Friday, November 21, 2008

Mailer Callbacks: hooks for ActionMailer

I've just published tiny library that I wrote on weekend and gonna use on production.
It is an extension to ActionMailer that gives two useful callbacks for your mailer classes: before_deliver and after_deliver. "before_deliver" helps to cancel delivery under certain conditions, "after" filter is usually for saving/logging sent emails.

http://github.com/kelyar/mailer_callbacks

That was the first release but it is stable enough to work.

Labels: , ,

Thursday, April 24, 2008

missing flash

I've just spent almost an hour trying to fix strange bug in signup procedure.
"flash" message that I sent from one action to another disappeared somewhere between requests.

The problem was in the multiple ajax requests that I completely forgot of)
flash.keep if request.xhr? fixes it

Labels: , , , ,

Thursday, May 24, 2007

JS/CSS caching in Rails 2.0

In order to remove extra HTTP connections because of small files, we use Asset Packager plugin. It makes one big JS or CSS file from all your assets making it faster to load for clients.
Bad thing is that I had to reset all HTML cache every time after deployment because svn revision is added to name of base.js. I bet it can be easily changed, but I had no time to check.

I've just found that this behavior will be standard in Rails 2.0 - if you are in production mode just add :cache=>true to javascript_include_tag. That's cool.
Plugins are great but it is always better to have it out of the box.

Labels: , , ,