ruby - Rails namespaced models give uninitialized constant errors -


i have 2 models in namespace project this: class project::foo , class project::bar

they have relationship

in app/models/project/foo.rb has_many :bars

in app/models/project/bar.rb belongs_to :foo

however when want call project::foo.create(...) or project::bar.create(...) nameerror uninitialized constant foo or bar respectively.

do need put in models? belongs_to :project::foo? or how fix this?

edit

in app/models/project/foo.rb reads:

module project   class foo     has_many :bars   end end 

and bars has same structure belongs_to in it

i still same error

if have class foo, code within file should look

module project #create scope   class foo    end end  

or may, define file project.rb

module project end 

and keep related models in project folder


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -