In my /lib i have this class below:
module Application
class Post < ActiveRecord::Base
attr_accessor :id
def artilce_content
post.articles.content
end
private
def post
Post.find(id)
end
end
end
But the problem is article
is undefined.
NoMethodError: undefined method ziptag_type' for #<Application::Api::V2::Ziptag:0x00000008edc120>
The question is, how can I use or include multiple models in /lib? I tried adding class User < ActiveRecord::Base; end
above module
class Article < ActiveRecord::Base; end
module Application
class Post < ActiveRecord::Base; end
:
:
:
end
end
but is doesn't worked.
Aucun commentaire:
Enregistrer un commentaire