What I like about Rails

Somebody asked a few months ago on LinkedIn, “What do you think about building a web application in Ruby on Rails?” Here’s my short answer:

Specifically, I love the way Rails lets you do database access. The simplest way to hit a database table with Rails is to run a generate scaffold command that creates the table for you and writes all the code for a super-basic CRUD (create, update, delete) web application. You can edit the generated “scaffold” to make it prettier or to add functionality.

When you go just a little farther, you find that the ActiveRecord class does most of the boring database work for you. Every table (“Model” in MVC parlance) is set up to inherit from ActiveRecord, and you don’t have to write out (in your code) what columns it contains because ActiveRecord figures it out for you at runtime.

Better still, you can add lines to your Model code such as :has_many x or :belongs_to y to indicate relationships (joins) with other tables. Again, Rails works out the details. You really don’t even have to know what database software is being used; ActiveRecord takes care of the vendor-specific differences.

Those are some specific things that make Rails so nice for web and database development. One of the hardest things for some people is getting used to NOT writing so much repetitive code.

That’s at the top of my list. What do you love about Ruby and Rails? Comments are open.