<% if params[:action] == 'new' or params[:action] == 'create' %> <% url = cavy_create_item_section_path %> <% method = 'post' %> <% else %> <% url = cavy_update_item_section_path(@item_section.id) %> <% method = 'patch' %> <% end %> <%= form_for @item_section, url: url, method: method do |f| %> <% if @item_section.errors.any? %>

<%= "#{pluralize(@item_section.errors.count, "error")} prohibited this item_section from being saved:" %>

<% end %>
<%= f.label :title, class: 'control-label' %> <%= f.text_field :title, class: 'form-control' %>
<%= f.label 'Item Groups', class: 'control-label' %> <% Cavy::ItemGroup.all.each do |group| %>
<%= group.title %>
<% end %>
<%= f.submit 'Save', class: 'button success' %> <% end %>