mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 20:32:02 +08:00
No more with_default_scope
on Rails master, see 94924dc32b
This commit is contained in:
parent
bb768a30ca
commit
f9110ad4cb
@ -45,7 +45,9 @@ unless rails4?
|
|||||||
class Relation
|
class Relation
|
||||||
|
|
||||||
def where_values_hash
|
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
|
node.left.relation.name == table_name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,13 @@ module Trashable
|
|||||||
#
|
#
|
||||||
# with this in place Post.limit(10).with_deleted, will work as expected
|
# 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.where_values.delete(with_deleted_scope_sql)
|
||||||
scope
|
scope
|
||||||
|
Loading…
x
Reference in New Issue
Block a user