Answer the question
In order to leave comments, you need to log in
What relationship between models to choose?
There is a model, let's call it Landing
, and also a model Template
I want to Landing
be able to have a one-to-one relationship with the model Template
, and Template
in turn have a one-to-many relationship. Those. Landing
can have one Template
, and the same one Template
can be assigned to several Landing
has_one :through
- great, but I don't need an intermediate model. It suggests a link through a join table. has_and_belongs_to_many
- also good, but not what I need, because Landing
should have a one-to-one relationship, not a one-to-many relationship.
What do you gentlemen advise?
Answer the question
In order to leave comments, you need to log in
What was wrong with has_many/belongs_to?
Template
has_many :landings
Landing
belongs_to :template
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question