Get a value of object field inside fields_for loop

后端 未结 2 529
野的像风
野的像风 2021-02-01 02:37

In the following scenario, I need to check the value of the object property in the fields_for loop.

<%= f.semantic_fields_for :review_details do          


        
2条回答
  •  走了就别回头了
    2021-02-01 03:06

    Formtastic adds additional features to the Rails code, but doesn't take away existing functionality so the following should work for you:

    rd.object.review_criteria_id
    

    'object' can be used in plain Rails form helpers to access the underlying bound object, and Formtastic honours this convention.

提交回复
热议问题