diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-07-27 17:55:43 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-07-27 17:55:43 +0100 |
commit | d1099540aff6cf00f31dafbbceed1f9fc48780a2 (patch) | |
tree | 1059bf064644bf1fa5adf36ddeccae774804dc75 /activerecord/lib | |
parent | b658cf1198bbeb0fb702cd10c6f491cd90cedba0 (diff) | |
download | rails-d1099540aff6cf00f31dafbbceed1f9fc48780a2.tar.gz rails-d1099540aff6cf00f31dafbbceed1f9fc48780a2.tar.bz2 rails-d1099540aff6cf00f31dafbbceed1f9fc48780a2.zip |
Deprecate Relation#all.
It has been moved to active_record_deprecated_finders.
Use #to_a instead.
Diffstat (limited to 'activerecord/lib')
4 files changed, 4 insertions, 17 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 2683aaf5da..6c5a9d73a9 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -171,7 +171,7 @@ module ActiveRecord def find_target return [] unless target_reflection_has_associated_record? - scoped.all + scoped.to_a end # NOTE - not sure that we can actually cope with inverses here diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index a80c1cec39..09f103100e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -490,7 +490,7 @@ module ActiveRecord def dump_schema_information #:nodoc: sm_table = ActiveRecord::Migrator.schema_migrations_table_name - ActiveRecord::SchemaMigration.order('version').all.map { |sm| + ActiveRecord::SchemaMigration.order('version').map { |sm| "INSERT INTO #{sm_table} (version) VALUES ('#{sm.version}');" }.join "\n\n" end diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index 5b78b246ab..fddfb5c11e 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -67,7 +67,7 @@ module ActiveRecord batch_size = options.delete(:batch_size) || 1000 relation = relation.reorder(batch_order).limit(batch_size) - records = relation.where(table[primary_key].gteq(start)).all + records = relation.where(table[primary_key].gteq(start)).to_a while records.any? records_size = records.size diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 974cd326ef..c01aed2d8e 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -133,19 +133,6 @@ module ActiveRecord last or raise RecordNotFound end - # Runs the query on the database and returns records with the used query - # methods. - # - # Person.all # returns an array of objects for all the rows fetched by SELECT * FROM people - # Person.where(["category IN (?)", categories]).limit(50).all - # Person.where({ :friends => ["Bob", "Steve", "Fred"] }).all - # Person.offset(10).limit(10).all - # Person.includes([:account, :friends]).all - # Person.group("category").all - def all - to_a - end - # Returns +true+ if a record exists in the table that matches the +id+ or # conditions given, or +false+ otherwise. The argument can take six forms: # @@ -285,7 +272,7 @@ module ActiveRecord end def find_some(ids) - result = where(table[primary_key].in(ids)).all + result = where(table[primary_key].in(ids)).to_a expected_size = if limit_value && ids.size > limit_value |