app/models/effective/effective_datatable/options.rb in effective_datatables-2.1.2 vs app/models/effective/effective_datatable/options.rb in effective_datatables-2.1.3

- old
+ new

@@ -49,10 +49,12 @@ cols[name][:width] ||= nil cols[name][:sortable] = true if cols[name][:sortable].nil? cols[name][:visible] = true if cols[name][:visible].nil? # Type + cols[name][:type] ||= cols[name][:as] # Use as: or type: interchangeably + cols[name][:type] ||= ( if belong_tos.key?(name) :belongs_to elsif has_manys.key?(name) :has_many @@ -112,9 +114,12 @@ filter = {type: filter.to_sym} if filter.kind_of?(String) filter = {} unless filter.kind_of?(Hash) # This is a fix for passing filter[:selected] == false, it needs to be 'false' filter[:selected] = filter[:selected].to_s unless filter[:selected].nil? + + # If you pass values, just assume it's a select + filter[:type] ||= :select if filter.key?(:values) # Check if this is an aggregate column if ['SUM(', 'COUNT(', 'MAX(', 'MIN(', 'AVG('].any? { |str| sql_column.include?(str) } filter[:sql_operation] = :having end