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 tarmo committed Aug 24, 2008
1 parent 6e71a35 commit 38a0d5c
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
Original file line number Diff line number Diff line change
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?|respond_to?)/
unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|^find|count|sum|average|maximum|minimum|paginate|first|last|empty?|respond_to?)/
delegate m, :to => :proxy_found
end
end
Expand Down
4 changes: 4 additions & 0 deletions activerecord/test/cases/named_scope_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,8 @@ def test_empty_should_not_load_results
topics.empty? # use loaded (no query)
end
end

def test_find_all_should_behave_like_select
assert_equal Topic.base.select(&:approved), Topic.base.find_all(&:approved)
end
end

6 comments on commit 38a0d5c

@ryanb
Copy link
Contributor Author

@ryanb ryanb commented on 38a0d5c Aug 25, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a dollar sign instead of an “€”, or is that a problem with GitHub?

@ryanb
Copy link
Contributor Author

@ryanb ryanb commented on 38a0d5c Aug 25, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a dollar sign instead of an “€”, or is that a problem with GitHub?

@masterkain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on my local copy it’s a dollar sign, so maybe it’s a problem with GitHub

@masterkain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on my local copy it’s a dollar sign, so maybe it’s a problem with GitHub

@masterkain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also seems like there’s a problem with double comments on a single submit

@NZKoz
Copy link
Member

@NZKoz NZKoz commented on 38a0d5c Aug 25, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha,

No it’s an actual euro sign, the error is fixed in a later commit.

Please sign in to comment.