diff options
author | Jefferson Lai <jefflai2@gmail.com> | 2014-02-10 03:00:05 -0800 |
---|---|---|
committer | Jefferson Lai <jefflai2@gmail.com> | 2014-04-23 17:21:45 -0700 |
commit | 9c3afdc327132c7f1f4d05eebc0c05b715442e7d (patch) | |
tree | 9c85b61fc019ee4c5a91fa4cf02bf39fd81fe008 /activerecord/test/models | |
parent | 9ed0cf51b467907810ef3959c8e9cdf77370370e (diff) | |
download | rails-9c3afdc327132c7f1f4d05eebc0c05b715442e7d.tar.gz rails-9c3afdc327132c7f1f4d05eebc0c05b715442e7d.tar.bz2 rails-9c3afdc327132c7f1f4d05eebc0c05b715442e7d.zip |
Fixes Issue #13466.
Changed the call to a scope block to be evaluated with instance_eval.
The result is that ScopeRegistry can use the actual class instead of base_class when
caching scopes so queries made by classes with a common ancestor won't leak scopes.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/comment.rb | 1 | ||||
-rw-r--r-- | activerecord/test/models/rating.rb | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb index ede5fbd0c6..6a9dfacf56 100644 --- a/activerecord/test/models/comment.rb +++ b/activerecord/test/models/comment.rb @@ -35,4 +35,5 @@ class SubSpecialComment < SpecialComment end class VerySpecialComment < Comment + scope :special_parent, -> (special_rating) { where parent_id: special_rating.special_comment.id } end diff --git a/activerecord/test/models/rating.rb b/activerecord/test/models/rating.rb index 25a52c4ad7..5409230c2e 100644 --- a/activerecord/test/models/rating.rb +++ b/activerecord/test/models/rating.rb @@ -2,3 +2,7 @@ class Rating < ActiveRecord::Base belongs_to :comment has_many :taggings, :as => :taggable end + +class SpecialRating < Rating + belongs_to :special_comment +end |