Can't read my MySQL Tables

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

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.

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

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.

Thanks askegg. Very well explain