<% if options.helpers? and !nested_classes_with_attributes.empty? -%> = form_for setup_<%= cls_underscore %>(@<%= cls.to_s.underscore %>)<%= @have_attachment_string %> do |f| <% else -%> = form_for @<%= cls.to_s.underscore %><%= @have_attachment_string %> do |f| <% end -%> - if @<%= cls.to_s.underscore %>.errors.any? #errorExplanation %h2 =pluralize(@<%= cls.to_s.underscore %>.errors.count, "error") prohibited this <%= cls.to_s.underscore.gsub("_"," ") %> from being saved: %ul -@<%= cls.to_s.underscore %>.errors.full_messages.each do |msg| %li= msg <% attributes_worth_using_in_the_form.each do |att| -%> .field = f.label :<%= att %> = f.<%= attr_form_method(cls, att) %> :<%= att %> <% end -%> <% if options.select_boxes? -%> <% non_nested_belongs_to_classes.each do |cls_name| -%> .field = f.label :<%= cls_name %>_id, "<%= cls_name.to_s.underscore.gsub("_", " ").camelize %>" = f.select :<%= cls_name %>_id, build_select_list(:<%= cls_name %>), {:prompt => "Please select one"} <% end -%> <% non_nested_has_many_classes.each do |cls_name| -%> .field = f.label :<%= cls_name.to_s.singularize %>_ids, "<%= cls_name.to_s.underscore.gsub("_", " ").camelize %>" = f.select :<%= cls_name.to_s.singularize %>_ids, build_select_list(:<%= cls_name %>), {:prompt => "Please select"}, {:multiple => true, :size => 4} <% end -%> <% end -%> <% nested_belongs_to_classes.each do |cls_name| -%> = f.fields_for :<%= cls_name %> do |nf| = render '<%= cls_name.to_s.singularize.underscore %>_fields', :f => nf <% end -%> <% nested_has_many_classes.each do |cls_name| -%> = f.fields_for :<%= cls_name %> do |nf| = render '<%= cls_name.to_s.singularize.underscore %>_fields', :f => nf <% if options.javascript? -%> %p= link_to_add_fields "Add <%= cls_name.to_s.singularize.gsub("_"," ") %>", f, :<%= cls_name %> <% end -%> <% end -%> = f.submit "Save" <% if options.javascript? -%> = content_for :head do = javascript_include_tag 'jquery.add_remove_links.js' <% end -%>