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

Popular posts from this blog

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

matlab - error with cyclic autocorrelation function -

php - Using grpc in Laravel, "Class 'Grpc\ChannelCredentials' not found." -