Skip to content

Instantly share code, notes, and snippets.

@rockkhuya
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockkhuya/8816363 to your computer and use it in GitHub Desktop.
Save rockkhuya/8816363 to your computer and use it in GitHub Desktop.
use cocoon to create nested
accepts_nested_attributes_for :tour_irregular_schedules,
allow_destroy: true, reject_if: proc { |a| a["start_date"].blank? && a['all_season_flg'].blank? }
<div class="control-group">
<%= f.label 'イレギュラースケジュール', class:'control-label' %>
<div class="controls" id="tour_irregular_schedule_controls">
<%= f.fields_for :tour_irregular_schedules do |tour_irregular_schedule_fields| %>
<%= render "tour_irregular_schedule_fields", f: tour_irregular_schedule_fields %>
<% end %>
<p><%= link_to_add_association "イレギュラースケジュール追加", f, :tour_irregular_schedules %></p>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment