Skip to content

Commit

Permalink
Support find_all on named scopes. [#730 state:resolved]
Browse files Browse the repository at this point in the history
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
ryanb authored and lifo committed Aug 21, 2008
1 parent 6be8251 commit 2415652
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/named_scope.rb
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions activerecord/test/cases/named_scope_test.rb
Expand Up @@ -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

0 comments on commit 2415652

Please sign in to comment.