aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-06-01 01:12:07 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-06-01 01:52:20 +0900
commit262ef5df706dcfaa8770108acbc178db32e3ae88 (patch)
treef975cad2fdddfe5d33e286facf2e6430375ec93a /activerecord
parent7c800fe5e338540ef195f071a7f3604ed4197f3f (diff)
downloadrails-262ef5df706dcfaa8770108acbc178db32e3ae88.tar.gz
rails-262ef5df706dcfaa8770108acbc178db32e3ae88.tar.bz2
rails-262ef5df706dcfaa8770108acbc178db32e3ae88.zip
Add missing `delegate :extending, to: :all`
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/querying.rb2
-rw-r--r--activerecord/test/cases/scoping/named_scoping_test.rb6
-rw-r--r--activerecord/test/models/comment.rb2
3 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/querying.rb b/activerecord/lib/active_record/querying.rb
index c4a22398f0..b16e178358 100644
--- a/activerecord/lib/active_record/querying.rb
+++ b/activerecord/lib/active_record/querying.rb
@@ -8,7 +8,7 @@ module ActiveRecord
delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, to: :all
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,
+ :where, :rewhere, :preload, :eager_load, :includes, :from, :lock, :readonly, :extending,
:having, :create_with, :distinct, :references, :none, :unscope, :merge, to: :all
delegate :count, :average, :minimum, :maximum, :sum, :calculate, to: :all
delegate :pluck, :ids, to: :all
diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb
index 0c2cffe0d3..483ea7128d 100644
--- a/activerecord/test/cases/scoping/named_scoping_test.rb
+++ b/activerecord/test/cases/scoping/named_scoping_test.rb
@@ -551,6 +551,12 @@ class NamedScopingTest < ActiveRecord::TestCase
assert_equal 1, SpecialComment.where(body: "go crazy").created.count
end
+ def test_model_class_should_respond_to_extending
+ assert_raises OopsError do
+ Comment.unscoped.oops_comments.destroy_all
+ end
+ end
+
def test_model_class_should_respond_to_none
assert !Topic.none?
Topic.delete_all
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb
index 8cba788598..d227f6fe86 100644
--- a/activerecord/test/models/comment.rb
+++ b/activerecord/test/models/comment.rb
@@ -29,6 +29,8 @@ class Comment < ActiveRecord::Base
default_scope { extending OopsExtension }
+ scope :oops_comments, -> { extending OopsExtension }
+
# Should not be called if extending modules that having the method exists on an association.
def self.greeting
raise