diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-07-20 02:11:17 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-07-20 02:11:17 -0300 |
commit | 9c6f348d7968dc544c29152f41bd5116449bf7ca (patch) | |
tree | 9ceec854e372f7ea85458bd60533ca1d09ee19e1 /activerecord/test | |
parent | b25e18007b4dc139c86cb027552c007658a6fbfa (diff) | |
parent | cf2574b1c9921377cbb5c7da38433b90fdc4a68c (diff) | |
download | rails-9c6f348d7968dc544c29152f41bd5116449bf7ca.tar.gz rails-9c6f348d7968dc544c29152f41bd5116449bf7ca.tar.bz2 rails-9c6f348d7968dc544c29152f41bd5116449bf7ca.zip |
Merge pull request #25849 from suginoy/fix_merge_in_scope
Fix the calling `merge` method at first in a scope
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/scoping/named_scoping_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb index 0e277ed235..f0dac07acc 100644 --- a/activerecord/test/cases/scoping/named_scoping_test.rb +++ b/activerecord/test/cases/scoping/named_scoping_test.rb @@ -46,6 +46,13 @@ class NamedScopingTest < ActiveRecord::TestCase assert_equal Topic.average(:replies_count), Topic.base.average(:replies_count) end + def test_calling_merge_at_first_in_scope + Topic.class_eval do + scope :calling_merge_at_first_in_scope, Proc.new { merge(Topic.replied) } + end + assert_equal Topic.calling_merge_at_first_in_scope.to_a, Topic.replied.to_a + end + def test_method_missing_priority_when_delegating klazz = Class.new(ActiveRecord::Base) do self.table_name = "topics" |