diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-07-31 16:08:22 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-07-31 16:08:22 -0300 |
commit | c1cbf02e3170f1004daf4a146cbc41176c2458d3 (patch) | |
tree | 80fab7d4fd73ddd1873ade3d01df5c9ad526747f /activerecord/lib/active_record/base.rb | |
parent | ca1e62f14219da3990bb354d4a363dbe6fa13435 (diff) | |
download | rails-c1cbf02e3170f1004daf4a146cbc41176c2458d3.tar.gz rails-c1cbf02e3170f1004daf4a146cbc41176c2458d3.tar.bz2 rails-c1cbf02e3170f1004daf4a146cbc41176c2458d3.zip |
Added ActiveRecord::Relation tests. Allow Relation to accept conditional
hashes and arrays like #find does.
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 7a34e345a2..9a3a02870a 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -663,7 +663,11 @@ module ActiveRecord #:nodoc: # This is an alias for find(:all). You can pass in all the same arguments to this method as you can # to find(:all) def all(*args) - construct_finder_arel(*args) + if args.empty? && !scoped?(:find) + arel_table + else + construct_finder_arel(*args) + end end # Executes a custom SQL query against your database and returns all the results. The results will @@ -2992,7 +2996,7 @@ module ActiveRecord #:nodoc: end def arel_table(reload = nil) - @arel_table = Relation.new(self, self.class.table_name) if reload || @arel_table.nil? + @arel_table = Relation.new(self.class, self.class.table_name) if reload || @arel_table.nil? @arel_table end |