Reputation: 4895
I'm running rails v 3.2 .
After some time developing application I need to move some models into namespace ex: /app/models/address.rb
to /app/models/local/address.rb
I tried simply moving models to destination folder and adding Local::
to the class name. then i accordingly update specs, and i still get an error on running spec.he . uninitialized constant Address (NameError)
.
The question is - How can i move models to a namespace? what are my actions - editing migrations or something else... Please help because i got mixed up by different articles & etc.
Update
I found out what's the problem:
Devise and namespaces. solving it
Upvotes: 10
Views: 5576
Reputation: 1055
I think you can try this:
create a new rails project, then run
rails g model Local::Address city:string country:string
Now you can see how rails handle namespace for model. You can just follow the way to modify yours.
Upvotes: 19