aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-07-29 16:46:16 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-07-29 16:54:54 -0700
commitd83b1828577c268de56e1b3942e16002c9efdd57 (patch)
tree7d3038fd5b21e63ce03418d23a52c609cd5def2f
parente566fc0577f336be35145b815f3fd0a554eab564 (diff)
downloadrails-d83b1828577c268de56e1b3942e16002c9efdd57.tar.gz
rails-d83b1828577c268de56e1b3942e16002c9efdd57.tar.bz2
rails-d83b1828577c268de56e1b3942e16002c9efdd57.zip
Revert "Methods invoked within named scope Procs should respect the scope stack. [#1267 state:resolved]"
This reverts commit 6a13376525f34a00e013fc3a6022838329dfe856. Conflicts: activerecord/test/cases/named_scope_test.rb
-rw-r--r--activerecord/lib/active_record/named_scope.rb7
-rw-r--r--activerecord/test/cases/named_scope_test.rb4
-rw-r--r--activerecord/test/models/topic.rb2
3 files changed, 1 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index dd2a90b8e5..bbe2d1f205 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -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
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb
index 92fe48cb5a..f4fdc9a39d 100644
--- a/activerecord/test/cases/named_scope_test.rb
+++ b/activerecord/test/cases/named_scope_test.rb
@@ -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
diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb
index 201d96dcd7..9594dc300a 100644
--- a/activerecord/test/models/topic.rb
+++ b/activerecord/test/models/topic.rb
@@ -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"