Skip to content
This repository
Browse code

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

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 38a0d5c0c7a37e22f9376c7cc363f4cf4f19a3d4 1 parent 6e71a35
Ryan Bates authored August 21, 2008 tarmo committed August 24, 2008
2  activerecord/lib/active_record/named_scope.rb
@@ -103,7 +103,7 @@ class Scope
103 103
       attr_reader :proxy_scope, :proxy_options
104 104
 
105 105
       [].methods.each do |m|
106  
-        unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|find|count|sum|average|maximum|minimum|paginate|first|last|empty?|respond_to?)/
  106
+        unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|^find€|count|sum|average|maximum|minimum|paginate|first|last|empty?|respond_to?)/
107 107
           delegate m, :to => :proxy_found
108 108
         end
109 109
       end
4  activerecord/test/cases/named_scope_test.rb
@@ -185,4 +185,8 @@ def test_empty_should_not_load_results
185 185
       topics.empty?  # use loaded (no query)
186 186
     end
187 187
   end
  188
+
  189
+  def test_find_all_should_behave_like_select
  190
+    assert_equal Topic.base.select(&:approved), Topic.base.find_all(&:approved)
  191
+  end
188 192
 end

6 notes on commit 38a0d5c

Ryan Bates

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

Ryan Bates

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

Claudio Poli

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

Claudio Poli

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

Claudio Poli

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

Michael Koziarski
Owner

Ha,

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

Please sign in to comment.
Something went wrong with that request. Please try again.