fields_for in rails view

前端 未结 1 1800
温柔的废话
温柔的废话 2021-01-27 13:28

When I attempt to use fields_for in the view code below, the company_name is not showing up in the view. What am I doing wrong?

= form_for @company do |f|
  -if         


        
1条回答
  •  醉梦人生
    2021-01-27 13:44

    Are you not building a showing object in your controller?

    @company.build_showing
    

    If you've defined accepts_nested_attributes_for on your Company model, then you'll need to set up the nested objects in the controller as well as the parent objects.

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