diff options
author | suginoy <suginoyasuhiro@gmail.com> | 2016-07-15 01:12:53 +0900 |
---|---|---|
committer | suginoy <suginoyasuhiro@gmail.com> | 2016-07-19 10:19:59 +0900 |
commit | cf2574b1c9921377cbb5c7da38433b90fdc4a68c (patch) | |
tree | 91abd59035e79f05407026ede4da4bb8fb26823d /activerecord/lib | |
parent | c02f3ea5e31677e7953abee5a1a2d5398d85ad47 (diff) | |
download | rails-cf2574b1c9921377cbb5c7da38433b90fdc4a68c.tar.gz rails-cf2574b1c9921377cbb5c7da38433b90fdc4a68c.tar.bz2 rails-cf2574b1c9921377cbb5c7da38433b90fdc4a68c.zip |
Fix the calling `merge` method at first in a scope
Changing the order of method chaining `merge` and other query
method such as `joins` should produce the same result.
```ruby
class Topic < ApplicationRecord
scope :safe_chaininig, -> { joins(:comments).merge(Comment.newest) }
scope :unsafe_chaininig, -> { merge(Comment.newest).joins(:comments) } #=> NoMethodError
end
```
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/querying.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/querying.rb b/activerecord/lib/active_record/querying.rb index 53ddd95bb0..f8dd35df0f 100644 --- a/activerecord/lib/active_record/querying.rb +++ b/activerecord/lib/active_record/querying.rb @@ -9,7 +9,7 @@ module ActiveRecord delegate :find_each, :find_in_batches, :in_batches, to: :all delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins, :left_joins, :left_outer_joins, :or, :where, :rewhere, :preload, :eager_load, :includes, :from, :lock, :readonly, - :having, :create_with, :uniq, :distinct, :references, :none, :unscope, to: :all + :having, :create_with, :uniq, :distinct, :references, :none, :unscope, :merge, to: :all delegate :count, :average, :minimum, :maximum, :sum, :calculate, to: :all delegate :pluck, :ids, to: :all |