No more `with_default_scope` on Rails master, see 94924dc32b

This commit is contained in:
Godfrey Chan 2013-12-13 08:27:50 -08:00
parent bb768a30ca
commit f9110ad4cb
2 changed files with 10 additions and 2 deletions

View File

@ -45,7 +45,9 @@ unless rails4?
class Relation
def where_values_hash
equalities = with_default_scope.where_values.grep(Arel::Nodes::Equality).find_all { |node|
values = rails_master? ? where_values : with_default_scope.where_values
equalities = values.grep(Arel::Nodes::Equality).find_all { |node|
node.left.relation.name == table_name
}

View File

@ -15,7 +15,13 @@ module Trashable
#
# with this in place Post.limit(10).with_deleted, will work as expected
#
scope = rails4? ? self.all.with_default_scope : self.scoped.with_default_scope
scope = if rails_master?
self.all
elsif rails4?
self.all.with_default_scope
else
self.scoped.with_default_scope
end
scope.where_values.delete(with_deleted_scope_sql)
scope