app/views/adminpanel/form/_select.html.erb in adminpanel-2.5.5 vs app/views/adminpanel/form/_select.html.erb in adminpanel-2.6.0
- old
+ new
@@ -1,21 +1,21 @@
<%
block = properties['options']
args = properties.except('options')
collection = block.call(f.object)
if collection.class.to_s.demodulize == 'ActiveRecord_Relation'
- id_method = :id
- label_method = :name
- else
- id_method = :first
- label_method = :last
+ properties['id_method'] ||= :id
+ properties['name_method'] ||= :name
+ collection = options_from_collection_for_select(
+ collection,
+ properties['id_method'],
+ properties['name_method'],
+ @resource_instance.send(attribute)
+ )
+
+ elsif ['Hash', 'Array', 'HashWithIndifferentAccess'].include? collection.class.to_s.demodulize
+ collection = options_for_select(collection)
end
- collection = options_from_collection_for_select(
- collection,
- id_method,
- label_method,
- @resource_instance.send(attribute)
- )
%>
<%= f.select attribute, collection, { include_blank: true }, args %>
<% if !is_modal &&
(