0 votes
in Ruby by

In ActiveRecord, what is the difference between the has_many and has_many :through associations?

a. The has_many: through association is the one-to-many equivalent to the belongs_to one-to-one association.

b. Both associations are identical, and has_many: through is maintained only for legacy purposes.

c. The has_many association is a one-to-many association, while has_many: through is a one-to-one association that matches through a third model.

d. Both are one-to-many associations but with has_many :through, the declaring model can associate through a third model.

1 Answer

0 votes
by

In ActiveRecord, what is the difference between the has_many and has_many :through associations?

Correct answer is :-  Both are one-to-many associations but with has_many :through, the declaring model can associate through a third model.

Related questions

0 votes
asked Aug 26, 2022 in Ruby by Robin
0 votes
asked Aug 26, 2022 in Ruby by Robin
...