This project is archived and is in readonly mode.

#5526 ✓committed
Mike Bethany

Parameter "-f" for "rails generate model" does not overwrite migration files

Reported by Mike Bethany | September 2nd, 2010 @ 12:25 AM

The rails g model ... -f option states, "-f, [--force] # Overwrite files that already exist" but migration file is not overwritten if it already exists for the model and results in an error message.

Rails 3.0.0
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02

Following these steps:
$ rails new demo
$ cd demo
$ rails g model testmodel
$ rails g model testmodel testfield:string -f

Receive error:
Another migration is already named create_testmodels: /Users//development/demo/db/migrate/20100901231151_create_testmodels.rb

Work around:
Delete migration file before regenerating model.

Comments and changes to this ticket

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=""></a>


Referenced by