I am Elegen T. McGraceful and I approve this message
Loosely Typed in Ohio

Tangible Rails Benefits

We’re nearly to the launch of our first Rails application for our largest client, which means it’s about time for me to write a rah-rah style post about how awesome developing the application was.

First blood, so to speak, goes to a Facebook App Chad wrote in Rails, but this app is more of a classic pattern for Innova: we get some data from a client, import it into Microsoft SQL Server, and clean things up as we go. These things don’t necessarily scream “Rails,” but she was up to the task nonetheless.

Coming from PHP development, there are several things that rocked my house as I was developing this app, things that our old Zend Framework or PHP simply couldn’t do:

  • script/console Being able to spawn an interactive session inside your application’s environment is ridiculously helpful. I had the basic application logic finished the first day because I was able to fire up a console and run some quick ActiveRecord commands to see what worked. And if something broke, I was able to fire up a console and start firing off commands and inspecting results. Much quicker than the var_dump then die style of PHP development we were using.

  • Plugins, esp. will_paginate Rails plugins are drop-in chunks of code that give you functionality you didn’t have before. In my case, I needed to paginate a set of database rows, which isn’t the most fun task. After I installed will_paginate, the work was done. I had an easy way to get paginated results from my models, and a one-step way to generate the page selection HTML. A lot of people cry about Ruby’s open classes, but things like this wouldn’t be possible otherwise.

  • Routes In PHP, we had to write several library functions to generate URLs for our site, for use in HTML links. Rails’ built in named routes and link\_to helper meant I never had to write any kind of setup code beyond the initial route.

That last one might seem like I’m really scraping the bottom of the barrel, but that’s just one example of a pattern I’ve noticed in Rails. link_to_unless_current is another: \writing a function that either generates a link or some non-link text based on what page you’re on isn’t hard, but since almost every web application does this you don’t have to write it. The number of times I’ve said something like “Crap, Rails has a built-in feature that handles that” or “oh, I just need this plugin, it takes care of it” is really astonishing.

Leave your mark

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Close
E-mail It
Socialized through Gregarious 42