Goodbye rails, hello padrino
Contrary to previous post, rails 3 was NOT playing nicely, thanks to conflicting requirements and an inability to escape rack 1.2.1. Padrino to the rescue?
I'm sure you know the feeling. You finally upgrade your site to use the latest and greatest gems, and every other site on your shared hosting suddenly borks. And then that site borks.
Despite hours of hacking and rehacking, rails was getting on my nerves. So I thought, why not try something different? Something lighter? Something more sinatra-y, and less likely to need the latest rack?
My first thought was to convert to sinatra. Sinatra is great. I use it all the time, but the time always comes where you look at the monstrousity of your application file and think "What have I become? Where are all those beautiful rubyish principles that I love so much?"
So being the type of person who likes to make things, I thought: Why not write a routing / controller system for sinatra? Oh foolish boy, will I never learn. Two hours into the endevour, and I had an API that I liked, but no implementation. Then I remembered padrino.
Padrino is essentially a cross between rails and sinatra - the speed, flexibility and simplicity of sinatra with the "framework feel" of rails. It has a routing / controller system (and a bloody good one at that), plus some of the inbuilt helpers from the rails world.
In all, it took me just over 2 hours to convert this website, and most of the time was spent looking up things I didn't know.
Of course, interesting though this is, the real question is: Would I be tempted, building a new project from scratch, to use padrino instead of rails? What does padrino do that rails can't?
Well for one, the rails routing systems is at best slightly obscure. You put your routes in a routes.rb file and then you have controller methods that don't quite match up to the routes you've set and rails has set up some lovely methods like edit_admin_blog_post_comment_url that then complain that it can't work out where you want to go because you added something different and it gets so confused and *BREATHE*...
Padrino, quite rightly, does away with that. Your custom routes are right next to your controller action. Urls are generated with url_for(:blog, :show, :id => 'foo'). Life is good.
The last thing I will say is that padrino is not impervious to the Dreamhost problem. If you have to use rake v1.2.1, then you need padrino 0.10.1, and I ran into a bug in padrino's render method. My fix was to remove a .to_sym call in padrino-helpers-0.10.1/lib/padrino-helpers/render_helpers.rb (naughty, I know.) But that small hitch aside, it went beautifully.
And yes, I will be using padrino for my next project.