app/models/effective/effective_datatable/resource.rb in effective_datatables-4.17.1 vs app/models/effective/effective_datatable/resource.rb in effective_datatables-4.17.2
- old
+ new
@@ -176,10 +176,12 @@
# Parameterize collection
if search[:collection].kind_of?(ActiveRecord::Relation)
search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.id] }
elsif search[:collection].kind_of?(Array) && search[:collection].first.kind_of?(ActiveRecord::Base)
search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.id] }
+ elsif search[:collection].kind_of?(Array)
+ search[:collection] = search[:collection]
end
search[:as] ||= :select if search.key?(:collection)
search[:value] ||= search.delete(:selected) if search.key?(:selected)
@@ -187,9 +189,11 @@
search_resource = [opts[:resource], effective_resource, fallback_effective_resource].compact
search_resource = search_resource.find { |res| res.klass.present? } || search_resource.first
if array_collection? && opts[:resource].present?
search.reverse_merge!(search_resource.search_form_field(name, collection.first[opts[:index]]))
+ elsif search[:as] == :select && search[:collection].kind_of?(Array)
+ # Nothing to do
elsif search[:as] != :string
search.reverse_merge!(search_resource.search_form_field(name, opts[:as]))
end
# Assign default search operation