Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails how to properly move models to a namespace

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

like image 438
Elmor Avatar asked Jul 03 '13 11:07

Elmor


1 Answers

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.

like image 61
Henry Avatar answered Nov 20 '22 01:11

Henry