"One person with a belief is equal to a force of ninety-nine who only have an interest."
The Rails team was hard at work and they recently released a new version of Rails; 2.0. Since I’ve got some time over the holiday break I’ve decided to jump in with it.
The beauty of Rails is that it allowed me to create a web app very quickly. I spent over a year trying to do my blog in php. After I switched to Ruby on Rails I had my app done in 3 months. Better programmers could do it in a week I’m sure, but I don’t bill myself as a programmer for a reason: I’m not good at it and therefore it takes me time to do it.
I was sold, I was a believer. I known that’s past tense, which really isn’t fair. I’m still a believer, but after spending a day with the new Rails I’m just a little perturbed.
I like to plan things. When I think about putting together an application I think about what the database is going to look like first. I want to know what the relationships are going to be. I spend time on this for one reason; when the application goes production and you have data in it, it becomes harder to change your table design because you have to deal with legacy information.
So I updated my rails gems and started a new rails app. I appreciate that I can now specify the database back end when generating the app. That’s a plus.
I then created my database migrations and put into them the columns I wanted. This was based on the design I had worked on outside of rails. I actually write this stuff down and diagram it so I know how I want it to work. What can I say? I’m a visual thinker.
That done, I did a rake migration and was pleased to see all my tables created in PostgreSQL.
Here’s where it started to go bad for me. In Rails 1.x you could generate a scaffold and it would automatically look at your database and determine the columns for the views.
In Rails 2.x it doesn’t do this. It now expects you to list the columns when you generate the scaffold. Yet I’ve already got the columns I want and I’m not interested in typing out a great big long command line again. A simple “script/generate scaffold
I did quite a bit of research thinking I was doing something wrong which, technically, I am. I came across a discussion which quite frankly, pissed me off.
The explanation for this change in behavior is that philosophically the rails team wants users to generate their own views and not rely on the scaffold.
Okay, fine. I can understand that. But removing the scaffold views as they were really doesn’t accomplish what they want. They want users to create better views. Hey great, I’m all for it. However part of the magic in Rails was being able to quickly add the CRUD in when a change was made in the back-end database.
When I develop an application I want to get functionality fast. Views are secondary. I can change the views easily once the application works as designed, but while I’m working I want to be able to quickly generate views with the basic CRUD in it. That used to be done with “script/generate
This blows. Am I being petty? Sure. But something that wasn’t a detriment to Rails overall was removed. What’s my motivation for using Rails over a different MVC? Right now, not a whole lot. If I have to spend time putting together my CRUD views by hand while I’m developing my app, then there really isn’t an impetus to use Rails. I can use Ruby in a couple different MVCs. So maybe it’s time to switch.
Merb looks interesting, and it may solve one of the problems I have with file uploads to my own blog.
So, maybe I’ll be saying goodbye to Rails. If I have to relearn how to use it anyway, I might be better served by learning a completely different MVC framework.