Answer the question
In order to leave comments, you need to log in
What type of model relationship should be used instead of belongs_to, to indicate belonging to several model objects?
Two models:
project authors (author) and projects (project).
The authors have several projects:
class Author < ActiveRecord::Base
has_many :projects
end
class Project < ActiveRecord::Base
belongs_to :author
end
integer :id
string :name
integer :author_id
integer :id
string :name
array :author_ids
Answer the question
In order to leave comments, you need to log in
Try using HATBM
This will require an additional plateauthors_projects
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question