Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support find_all on named scopes. [#730 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 2415652660242d6b0da97119c562ecff82928575 1 parent 6be8251
@ryanb ryanb authored lifo committed
View
2  activerecord/lib/active_record/named_scope.rb
@@ -103,7 +103,7 @@ class Scope
attr_reader :proxy_scope, :proxy_options
[].methods.each do |m|
- unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|find|count|sum|average|maximum|minimum|paginate|first|last|empty?|any?|respond_to?)/
+ unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|^find$|count|sum|average|maximum|minimum|paginate|first|last|empty?|any?|respond_to?)/
delegate m, :to => :proxy_found
end
end
View
4 activerecord/test/cases/named_scope_test.rb
@@ -238,4 +238,8 @@ def test_should_build_with_proxy_options_chained
assert topic.approved
assert_equal 'lifo', topic.author_name
end
+
+ def test_find_all_should_behave_like_select
+ assert_equal Topic.base.select(&:approved), Topic.base.find_all(&:approved)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.