public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Let Base.all use conditions etc like first/last
David Heinemeier Hansson (author)
Mon Apr 28 11:27:52 -0700 2008
commit  0a6980f2dc6ef8b211323e0655f41702a4ce3eae
tree    8160d06eb90fc794449d8e78a5b280b4136dc4bd
parent  850aba5473ce14edcd067f16badfa198e2070095
...
532
533
534
 
 
 
 
 
 
535
536
537
...
532
533
534
535
536
537
538
539
540
541
542
543
0
@@ -532,6 +532,12 @@ module ActiveRecord #:nodoc:
0
         find(:last, *args)
0
       end
0
       
0
+ # This is an alias for find(:all). You can pass in all the same arguments to this method as you can
0
+ # to find(:all)
0
+ def all(*args)
0
+ find(:all, *args)
0
+ end
0
+
0
       #
0
       # Executes a custom sql query against your database and returns all the results. The results will
0
       # be returned as an array with columns requested encapsulated as attributes of the model you call
...
11
12
13
14
15
16
17
...
11
12
13
 
14
15
16
0
@@ -11,7 +11,6 @@ module ActiveRecord
0
     def self.included(base)
0
       base.class_eval do
0
         extend ClassMethods
0
- named_scope :all
0
         named_scope :scoped, lambda { |scope| scope }
0
       end
0
     end
...
1630
1631
1632
 
 
 
 
1633
1634
1635
...
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
0
@@ -1630,6 +1630,10 @@ class BasicsTest < ActiveRecord::TestCase
0
   def test_last
0
     assert_equal Developer.find(:first, :order => 'id desc'), Developer.last
0
   end
0
+
0
+ def test_all_with_conditions
0
+ assert_equal Developer.find(:all, :order => 'id desc'), Developer.all(:order => 'id desc')
0
+ end
0
   
0
   def test_find_ordered_last
0
     last = Developer.find :last, :order => 'developers.salary ASC'

Comments

    No one has commented yet.