328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
# File 'lib/arel_extensions.rb', line 328
def except_predicates(columns)
attrs = columns. { |node| node.is_a?(Arel::Attribute) }
non_attrs = columns. { |node| node.is_a?(Arel::Predications) }
predicates.reject do |node|
if !non_attrs.empty? && node.equality? && node.left.is_a?(Arel::Predications)
non_attrs.include?(node.left)
end || Arel.fetch_attribute(node) do |attr|
attrs.find { |v| v.eql? attr } || columns.include?(attr.name.to_s) end
end
end
|