This project is archived and is in readonly mode.

#6644 new
ramaboo

Rails Generator Fails with Existing Migration

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

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

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages