app/models/effective/effective_datatable/resource.rb in effective_datatables-3.2.4 vs app/models/effective/effective_datatable/resource.rb in effective_datatables-3.2.5

- old
+ new

@@ -17,20 +17,23 @@ @resource = Effective::Resource.new(collection_class, namespace: controller_namespace) if active_record_collection? columns.each do |name, opts| + # col 'comments.title' if name.kind_of?(String) && name.include?('.') raise "invalid datatables column '#{name}'. the joined syntax only supports one dot." if name.scan(/\./).count > 1 (associated, field) = name.split('.').first(2) unless resource.macros.include?(resource.sql_type(associated)) raise "invalid datatables column '#{name}'. unable to find '#{name.split('.').first}' association on '#{resource}'." end - unless collection.joins_values.include?(associated) || collection.joins_values.include?(associated.to_sym) - raise "your datatables collection must .joins(:#{associated}) to work with the joined syntax" + joins_values = (collection.joins_values + collection.left_outer_joins_values) + + unless joins_values.include?(associated.to_sym) + raise "your datatables collection must .joins(:#{associated}) or .left_outer_joins(:#{associated}) to work with the joined syntax" end opts[:resource] = Effective::Resource.new(resource.associated(associated), namespace: controller_namespace) if opts[:resource].column(field)