ruby on rails 4 - How to order in nested form -


the code below working on edit, display details according order. when try add new detail, submit it, , validation occurs, can't see newly added detail. tried remove ordering , shows detail.

code :

<%= simple_form_for @master_template, :html=> { class: "form-horizontal style-form" }  |f| %>     <%= f.simple_fields_for :master_template_details, f.object.master_template_details.order("name desc"), :wrapper => false |p| %>         <%= render 'master_template_detail_fields', {f: p} %>     <% end %> <% end %> 

i tried this:

#model scope :ordered, -> { order("name desc") } belongs_to :master_template  #view <%= simple_form_for @master_template, :html=> { class: "form-horizontal style-form" }  |f| %>     <%= f.simple_fields_for :master_template_details, f.object.master_template_details.ordered, :wrapper => false |p| %>         <%= render 'master_template_detail_fields', {f: p} %>     <% end %> <% end %> 

but still not working


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -