Question

I wrote a simple migration file that creates around ten tables. It all created perfectly. Now I need to create ten equivalent model files in the app/models folder. I can do it manually. But I am wondering if there is any rake task available to do this.

Tips/advise on this is much appreciated.

OTHER TIPS

You can create a model and migration using the same rails model generator. This will also create a unit test and fixtures.

Rails 2.3.x:

script/generate model Person name:string

Rails 3.0.x

rails g model Person name:string

You can also use the following options (taken from Rails 2.3.8 and might have changed in 3.0)

Options:
  --skip-timestamps    Don't add timestamps to the migration file for this model
  --skip-migration     Don't generate a migration file for this model
  --skip-fixture       Don't generation a fixture file for this model
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top