Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rails Generator Fails with Existing Migration

#6644

I have a basic rails project and run a generator

$ rails g scaffold foo name:string

Pretty straight forward. I am creating a Foo model with a name field. The controller runs fine however if I run the same command again say something like this (realizing that I forgot the age field):

$ rails g scaffold foo name:string age:string

I get the following error
Another migration is already named create_foos: /var/www/chimporter.com/db/migrate/20110329171246_create_foos.rb

The preferred action would be some sort of Do you want to override prompt that is common on the other controller actions. If I delete the above migration file I can then run the second migration and overwrite the existing files as expected.

Solution
Add an overwrite prompt to the active_record generator.

David

Reported by ramaboo · March 29th, 2011 @ 06:19 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

No comments yet.