1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Methods invoked within named scope Procs should respect the scope stack. [#1267 state:resolved]"

This reverts commit 6a13376525.

Conflicts:

	activerecord/test/cases/named_scope_test.rb
This commit is contained in:
Jeremy Kemper 2009-07-29 16:46:16 -07:00
parent e566fc0577
commit d83b182857
3 changed files with 1 additions and 12 deletions

View file

@ -92,12 +92,7 @@ module ActiveRecord
when Hash
options
when Proc
case parent_scope
when Scope
with_scope(:find => parent_scope.proxy_options) { options.call(*args) }
else
options.call(*args)
end
options.call(*args)
end, &block)
end
metaclass.instance_eval do

View file

@ -354,10 +354,6 @@ class NamedScopeTest < ActiveRecord::TestCase
assert_equal [posts(:sti_comments)], Post.with_special_comments.with_post(4).all.uniq
end
def test_methods_invoked_within_scopes_should_respect_scope
assert_equal [], Topic.approved.by_rejected_ids.proxy_options[:conditions][:id]
end
def test_named_scopes_batch_finders
assert_equal 3, Topic.approved.count

View file

@ -35,8 +35,6 @@ class Topic < ActiveRecord::Base
end
named_scope :named_extension, :extend => NamedExtension
named_scope :multiple_extensions, :extend => [MultipleExtensionTwo, MultipleExtensionOne]
named_scope :by_rejected_ids, lambda {{ :conditions => { :id => all(:conditions => {:approved => false}).map(&:id) } }}
has_many :replies, :dependent => :destroy, :foreign_key => "parent_id"
has_many :replies_with_primary_key, :class_name => "Reply", :dependent => :destroy, :primary_key => "title", :foreign_key => "parent_title"