ruby on rails - Is it possible to associate records N-N multiple times via different name? -
i'm using mongoid.
if task has list of writers, task has_many :writers
, writer has_many :tasks
.
what if want task has_many :editors
well, have writer
model act editor?
in other words, there way relate same model twice?
something this, please check correctness , adjust if needed
has_many :editors, class_name: "writer", inverse_of: :writter
so should use inverse_of , class_name
Comments
Post a Comment