mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add missing delegate :extending, to: :all
This commit is contained in:
parent
7c800fe5e3
commit
262ef5df70
3 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue