Sha256: ab4d7062c8622fb14d6dfd4602ef4708a5e34fb95a5fccf0165eda004ba9da7c
Contents?: true
Size: 1.26 KB
Versions: 5
Compression:
Stored size: 1.26 KB
Contents
<% child_key = association[:child_key].first 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[#{name}][]", :id => 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
5 entries across 5 versions & 2 rubygems