app/models/effective/effective_datatable/resource.rb in effective_datatables-4.8.8 vs app/models/effective/effective_datatable/resource.rb in effective_datatables-4.8.9

- old
+ new

@@ -96,13 +96,15 @@ when :string # This is the fallback # Anything that doesn't belong to the model or the sql table, we assume is a SELECT SUM|AVG|RANK() as fancy opts[:sql_as_column] = true if (effective_resource.table && effective_resource.column(name).blank?) end - if opts[:sql_column].present? && AGGREGATE_SQL_FUNCTIONS.any? { |str| opts[:sql_column].to_s.start_with?(str) } - opts[:sql_as_column] = true + if opts[:sql_column].present? + sql_column = opts[:sql_column].to_s + opts[:sql_as_column] = true if AGGREGATE_SQL_FUNCTIONS.any? { |str| sql_column.start_with?(str) } end + end end def load_active_record_array_collection! return unless active_record_array_collection? @@ -198,10 +200,10 @@ end end def load_resource_belongs_tos! return unless active_record_collection? - return unless @_collection_apply_belongs_to + return unless @_collection_apply_belongs_to changed = attributes.select do |attribute, value| attribute = attribute.to_s next unless attribute.ends_with?('_id')