Rails cocoon f.fields_for not working -


i'm working project requires nested forms add multiple valves single order (order called rfq in case).

i error:

actionview::template::error (uninitialized constant rfq::valf):     48:   </div>     49:     50:   <div id="valves">     51:     <%= f.fields_for :valves |valve| %>     52:       <%= render 'valve_fields', f: valve %>     53:     <% end %>     54:       <%= link_to_add_association 'add valve', f, :valves %> 

here's relevant part of form partial,

<%= form_for @rfq |f| %> ...   <div class="field">     <%= f.label :application %><br>     <%= f.text_field :application %>   </div>    <div id="valves">     <%= f.fields_for :valves |valve| %>       <%= render 'valve_fields', f: valve %>     <% end %>       <%= link_to_add_association 'add valve', f, :valves %>   </div>    <div class="actions">     <%= f.submit %>   </div> <% end %> 

valve fields partial:

<div class="nested-fields">     <div class="field">         <%= f.label :line %>         <%= f.text_field :productline %>     </div>     <%= link_to_remove_association "remove valve", f %> </div> 

rfq model:

class rfq < activerecord::base     has_many :valves     accepts_nested_attributes_for :valves, :allow_destroy => true     belongs_to :customer     has_paper_trail end 

valve model:

class valve < activerecord::base     belongs_to :rfq     has_paper_trail end 

thanks in advance

try specifying "valve" class name illustrated below.

class rfq < activerecord::base   has_many :valves, :class_name => "valve"   accepts_nested_attributes_for :valves, :allow_destroy => true   belongs_to :customer   has_paper_trail end 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -