Wednesday, September 24, 2008
DB Table name != pluralize(model name)
Tuesday, September 16, 2008
Scaffolding in Rails 2.0
With Rails 2.0, you cant do the following
- selectively scaffold a model /controller / migration.
- generate model and controller with different names via a single scaffold command.
Naturally, there was a big furor regarding scaffold philosophy change. Check out this scaffold discussion here.
The post Rails 2.0 era has scaffold working like this , basically all-in-one command, compact and rigid -
> ruby script\generate scaffold product
- The above command generates model, migration, controller, view and view helpers, all at one go. However, do remember to give the db columns of the product table in the scaffold command else the skelton gets generated for a non-attribute table/model which effectively doesnt serve any purpose. So here you go -
Thursday, September 11, 2008
How to figure out pre-installed ROR versions on a machine
Just in case, you are handed an already configured machine, complete with ROR setup.
To save some noise pollution asking people around for ROR environment/versions in your pre-configured machine :),
you are better off using the following command -
> ruby script\about
Would return something like this -
About your application's environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.1.1
Rails version 2.0.2
Active Record version 2.0.2
Action Pack version 2.0.2
Active Resource version 2.0.2
Action Mailer version 2.0.2
Active Support version 2.0.2
Edge Rails revision 798
Application root C:/workspace/nr
Environment development
Database adapter mysql
- You can also view individual versions like
> gem --version