Forum: Ruby on Rails simple migration problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A9d978cc8870cddcbd4bb6ac6582d98e?d=identicon&s=25 Andrew (Guest)
on 2006-03-30 19:13
Hi:

I'm running RoR 1.1

I'm going through the Agile book Depot example and I want to generate my
next migration file so i'm typing

./script/generate migration depot

I was sort of expecting to get the file 002_depot.rb .. instead i'm
being informed that there already exists a migration named depot..and no
new file is generated..

should I be using a new name? I tried that accidentally and got
002_help.rb

?
8716cce9a7b721786e5425b8cc1f9951?d=identicon&s=25 sean lynch (Guest)
on 2006-03-30 19:50
The agile book came out while migrations were a work in progress, so it
doesn't really cover this.

If you look at the file you create you will notice that the migration
creates a class with a name the same as you gave in the migration:

class Products < ActiveRecord::Migration
...
end

this is without the 001_ or 002_, so you would have a clas name conflict
if you use the same name twice.

Here is a link to some docs:
http://api.rubyonrails.com/classes/ActiveRecord/Mi...

-Sean

Andrew wrote:
> Hi:
>
> I'm running RoR 1.1
>
> I'm going through the Agile book Depot example and I want to generate my
> next migration file so i'm typing
>
> ./script/generate migration depot
>
> I was sort of expecting to get the file 002_depot.rb .. instead i'm
> being informed that there already exists a migration named depot..and no
> new file is generated..
>
> should I be using a new name? I tried that accidentally and got
> 002_help.rb
>
> ?
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2006-03-30 19:54
(Received via mailing list)
Different name definitely.

To get help, just leave out the final arg:
./script/generate migration

Did you know that if you generate model Foo that it will create the
migration for create_foos automatically?

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
+1 513-295-4739
A9d978cc8870cddcbd4bb6ac6582d98e?d=identicon&s=25 Andrew (Guest)
on 2006-03-30 21:06
Thank you Rob and Sean... the class name argument makes perfect sense.

cheers!
This topic is locked and can not be replied to.