Answer the question
In order to leave comments, you need to log in
How to make fields associated with a belongs_to association optional?
Good evening
. I have several columns in the model associated with the belongs_to association, in which I need to insert the id of another object.
class FirstModel < ApplicationRecord
belongs_to :secondmodel_object_a
belongs_to :secondmodel_object_b
belongs_to :secondmodel_object_c
<p>@firstmodel.title</p>
<p>@firstmodel.secondmodel_object_a</p>
<p>@firstmodel.secondmodel_object_b</p>
<p>@firstmodel.secondmodel_object_c</p>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question