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.

Generated migration for namespaced model prefixes table name

#2267

When generating a namespaced model the migration prefixes the table name with the namespace even though current Rails behaviour is to only prefix a table name when nested inside another AR model. e.g:

script/generate model Admin::User

generates:


class CreateAdminUsers < ActiveRecord::Migration
  def self.up
    create_table :admin_users do |t|

      t.timestamps
    end
  end

  def self.down
    drop_table :admin_users
  end
end

I've not got a patch at the moment because I can't decide where the problem should be fixed or what the correct behavior should be. I was investigating #2262 Associations are picking the wrong class so I'm just logging the problem for now to build up a list of issues with namespaced models with the aim of building a bunch of failing tests.

Reported by Andrew White · March 17th, 2009 @ 10:55 AM

State: duplicate
Milestone: 2.x
Assigned to: José Valim José Valim
Importance: none

Activity

  1. Daniel Guettler
    Daniel Guettler

    Actually this is what I would expect to happen. At least I'm using it this way successfully now since quite some time.

    March 17th, 2009 @ 01:25 PM

  2. kmpm
    kmpm

    #1976 Scaffold generator not working well with namespaced resources is in the same general area as this one as well so people definitely do have issues with this.

    July 27th, 2009 @ 11:15 AM

  3. Andrew White
    Andrew White
    • Assigned user set to José Valim

    This can be closed as we're addressing the issue in #4320 [Patch] Can't install plug in on Windows

    April 11th, 2010 @ 09:35 AM

  4. José Valim
    José Valim
    • State changed from new to duplicate

    Thanks Andrew. :)

    April 11th, 2010 @ 10:25 AM