hi, I am trying to create a new model by ruby script/model Personnel. But when I look into the personnel.rb there are no fields generated. Where should I check this problem? Thanks
on 2007-01-23 20:40
on 2007-01-23 21:43
> I am trying to create a new model by ruby script/model Personnel. But > when I look into the personnel.rb there are no fields generated. Where > should I check this problem? > There won't be any fields in the model file. Rails looks at your database table and figures out the structure dynamically. There should be a migration file to create a database table - you can specify columns there. And then look in mysql at the table you created.
on 2007-01-24 01:42
Thanks toby, I try to generate a scaffold and everything went well. What will be the purpose of specifying columns in the migration file? james
on 2007-01-24 02:25
Migrations are a way for Rails to create the tables for you if you do not already have them. Very handy if you are starting from scratch, working with others or need to make schema changes during deployment/upgrades (especially when using Capistrano). Since migrations exist within Rails they have access to all you models/etc, so manipulating the data can be scripted and the logic captured.
on 2007-01-24 04:39
Thanks askegg. Very well explain