Sha256: 62429f2a8937a288f22431d6afc88518bd615244916c7317f938627d48f46699
Contents?: true
Size: 1.3 KB
Versions: 11
Compression:
Stored size: 1.3 KB
Contents
<% child_key = association[:child_key].first association_name = association[:name] collection = MerbAdmin::AbstractModel.new(association[:child_model]).all.map{|o| [o.id, object_title(o)]}.sort_by{|o| o[1]} selected = @object.send(association_name) label = association[:pretty_name] required = false @properties.each do |property| next unless property[:name] == child_key required = true unless property[:nullable?] end %> <fieldset class="module aligned"> <h2><%= label %></h2> <div class="<%= @object.errors[child_key] ? "form-row errors" : "form-row" %>"> <% if @object.errors[child_key] %> <ul class="errorlist"> <% @object.errors[child_key].each do |error| %> <li><%= error %></li> <% end %> </ul> <% end %> <div> <%= select(:name => "associations[#{association_name}][]", :id => association_name, :collection => collection, :include_blank => true, :selected => selected ? selected.id.to_s : nil, :label => label) %> <p class="help"> <%= required ? "Required." : "Optional." %> </p> </div> </div> </fieldset>
Version data entries
11 entries across 11 versions & 1 rubygems