Commit adb6f47a by John Hawthorn

Use #where instead of #and for rails 5

In rails 4.x this passed around a set of arel conditions, in rails 5 it
passes around an AR::Relation and uses where().

See rails/rails@5f521cbff3c8a46cfc8e16b234294a20c285d00d
parent f4e7ce06
......@@ -265,7 +265,12 @@ module ActiveRecord
def build_relation(klass, table, attribute, value)
relation = super(klass, table, attribute, value)
return relation unless klass.respond_to?(:paranoia_column)
relation.and(klass.arel_table[klass.paranoia_column].eq(klass.paranoia_sentinel_value))
arel_paranoia_scope = klass.arel_table[klass.paranoia_column].eq(klass.paranoia_sentinel_value)
if ActiveRecord::VERSION::STRING >= "5.0"
relation.where(arel_paranoia_scope)
else
relation.and(arel_paranoia_scope)
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment