Skip to content

Commit

Permalink
Delegate #rewhere to all on the class like all other relation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Nov 3, 2013
1 parent fe97734 commit 661637e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/querying.rb
Expand Up @@ -7,7 +7,7 @@ module Querying
delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, to: :all delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, to: :all
delegate :find_each, :find_in_batches, to: :all delegate :find_each, :find_in_batches, to: :all
delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins, delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins,
:where, :preload, :eager_load, :includes, :from, :lock, :readonly, :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, to: :all
delegate :count, :average, :minimum, :maximum, :sum, :calculate, to: :all delegate :count, :average, :minimum, :maximum, :sum, :calculate, to: :all
delegate :pluck, :ids, to: :all delegate :pluck, :ids, to: :all
Expand Down
4 changes: 4 additions & 0 deletions activerecord/test/cases/relation/where_test.rb
Expand Up @@ -24,6 +24,10 @@ def test_where_copies_bind_params
} }
end end


def test_rewhere_on_root
assert_equal posts(:welcome), Post.rewhere(title: 'Welcome to the weblog').first
end

def test_belongs_to_shallow_where def test_belongs_to_shallow_where
author = Author.new author = Author.new
author.id = 1 author.id = 1
Expand Down

0 comments on commit 661637e

Please sign in to comment.