<% child_key = association[:child_key].first collection = MerbAdmin::AbstractModel.new(association[:parent_model]).all.map{|o| [o.id, object_name(o)]}.sort_by{|o| o[1]} selected = @object.send(child_key) label = association[:pretty_name] required = false errors_exist = !(@object.errors[child_key].nil? || @object.errors[child_key].empty?) @properties.select{|property| property[:name] == child_key}.each do |property| required = true unless property[:nullable?] end %>

<%= label %>

"> <% if errors_exist %> <% end %>
<%= select(child_key, :collection => collection, :include_blank => true, :selected => selected.to_s, :label => label) %>

<%= required ? "Required." : "Optional." %>