ruby on rails - How to remove default initial second nested field? -
hi im using nested_forms rails. https://github.com/ryanb/nested_form
is working great problem every time user edit info, default new field added, need new field added until user clic "add more" in link can see usage of gem documentation dosent this..
here code:
<%= f.fields_for :citizens |citizen_form| %> <div> <%= citizen_form.label :citizen, t('generales.citizen') %> <%= citizen_form.select :country_id , country.all.collect {|p| [ t("generales."+p.iso), p.id ] }, { :include_blank => true } , { :class => 'pca33' } %> <div id="delerr"><%= citizen_form.link_to_remove t('generales.delete') %></div> </div> <% end %> <%= f.link_to_add t('generales.add'), :citizens %>
ok found answer..
here way this.
@project.tasks.build unless @project.tasks.any?
wich in case was.
@player.citizens.build unless @player.citizens.any?
hope helps someone.
Comments
Post a Comment