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.

Namespaced model table name inconsistency

#2674

Example you:

% script/generate model user/tag
      create  app/models/user
      create  test/unit/user
      create  test/fixtures/user
      create  app/models/user/tag.rb
      create  test/unit/user/tag_test.rb
      create  test/fixtures/user_tags.yml
      exists  db/migrate
      create  db/migrate/20090518233442_create_user_tags.rb
% rake db:migrate
==  CreateUserTags: migrating =================================================
-- create_table(:user_tags)
   -> 0.0022s
==  CreateUserFlags: migrated (0.0029s) =======================================
% script/console
>> User::Tag
=> User::Tag(Table doesn't exist)
>> User::Tag.table_name
=> "tags"

So:

  1. Migration generates table name that accounts for namespace.
  2. Model suppresses namespace when assuming table name.

I'm happy to provide a patch, but what's the expected behavior? It seems to me that namespaces should persist to the table.

Reported by Stephen Celis · May 19th, 2009 @ 12:48 AM

State: duplicate
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. CancelProfileIsBroken
    CancelProfileIsBroken
    • State changed from new to duplicate

    Appears to be a duplicate of #2267 Generated migration for namespaced model prefixes table name - maybe you can work together on diagnosis and fix. #1976 Scaffold generator not working well with namespaced resources is in the same general arena as well.

    May 19th, 2009 @ 01:49 AM