aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r--activerecord/lib/active_record/named_scope.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index aac00cc54a..9abf979cd0 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -167,7 +167,14 @@ module ActiveRecord
end
def ==(other)
- other.respond_to?(:to_ary) ? to_a == other.to_a : false
+ case other
+ when Scope
+ to_sql == other.to_sql
+ when Relation
+ other == self
+ when Array
+ to_a == other.to_a
+ end
end
private