Accessing nested model attributes inside a fields_for without using FormBuilder

后端 未结 2 1279
爱一瞬间的悲伤
爱一瞬间的悲伤 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:48

    Not sure if this is what you need, but couldn't you include the model data as a local? like:

    <%= render :partial => 'customer_image_show', :locals => { :f => images_form, :customer_image => @customer_image } %>
    
    0 讨论(0)
  • 2021-02-05 14:53

    You can call

    f.object
    

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

    0 讨论(0)
提交回复
热议问题