ruby - Refering a model in sub-directory in rails -
i'm writing rails application.
my model tree looks this:
models/ |- user.rb |- ... |- forum/ |- thread.rb |- forum.rb a user has many threads.
when try this:
has_many :forum_threads i following error when trying refer it:
uninitialized constant user::forumthread however, when try this:
has_many :threads i following error:
undefined method `scoped' thread:class what have done wrong? can causing this?
i've managed solve it. had add :class_name specifier has_many decleration:
has_many :forum_threads, class_name: 'forum::thread'
Comments
Post a Comment