Accessing nested model attributes inside a fields_for without using FormBuilder

后端 未结 2 1315
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 14:14

I have a Rails form that is being used for creating and editing a model with a has_many relationship. I\'m very familiar with typical forms with nested models, but my current pr

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 14:53

    You can call

    f.object
    

    to get to the object that the form is associated with.

提交回复
热议问题