<% child_key = association[:child_key].first collection = MerbAdmin::AbstractModel.new(association[:parent_model]).all.map{|object| [object.id, object_label(object)]}.sort_by{|object| object[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." %>