Grouping models - table name conflicts


#1

Hi all, it’s my first time posting on the list - this is something I
couldn’t
find anywhere else

If I create two models, using
ruby script/generate model foo/bar
ruby script/generate model baz/bar

then the generator has no problem making app/models/foo/bar.rb and
app/models/baz/bar.rb, however the migrate files it creates both try to
“create_table :bars”

I thought this was strange because the migrate files have unique names,
001_create_foo_bars.rb, 002_create_baz_bars.rb

I appreciate that it’s often a good idea to keep all models directly in
app/models/ but I couldn’t see a reason that everything supports the
option to
group models, except for the migration. What am I missing?

Cheers,
Gareth


#2

Gareth A. <gareth@…> writes:

I thought this was strange because the migrate files have unique names,
001_create_foo_bars.rb, 002_create_baz_bars.rb

My bad, I’ve just seen that there is a problem with the second model -
it
creates a conflicting migration file error.

But I’m still confused about why the model creation is fine but the
migration
creation isn’t