diff options
author | Xavier Noria <fxn@hashref.com> | 2011-05-20 03:19:13 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-05-20 03:19:13 -0700 |
commit | 5b8bc4613c179e92f1887b9f6d80898e6dd7108c (patch) | |
tree | 4b6503500e5fde6279bacb8afd5d5b02fa41848f | |
parent | 54823fe6b93d75a90cd627e3852669b5721fdd1f (diff) | |
parent | 159213001ae1d13d0d3eb7947c0595328ef16945 (diff) | |
download | rails-5b8bc4613c179e92f1887b9f6d80898e6dd7108c.tar.gz rails-5b8bc4613c179e92f1887b9f6d80898e6dd7108c.tar.bz2 rails-5b8bc4613c179e92f1887b9f6d80898e6dd7108c.zip |
Merge pull request #1161 from guilleiguaran/each_syntax_in_activerecord
Syntax cleanup: for in => each on ActiveRecord
4 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index cd16b8d3ca..30e2d1a82c 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2018,7 +2018,7 @@ MSG def extract_callstack_for_multiparameter_attributes(pairs) attributes = { } - for pair in pairs + pairs.each do |pair| multiparameter_name, value = pair attribute_name = multiparameter_name.split("(").first attributes[attribute_name] = {} unless attributes.include?(attribute_name) diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 32d1cff6c3..475e4338ca 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -226,7 +226,7 @@ module ActiveRecord end def apply_join_dependency(relation, join_dependency) - for association in join_dependency.join_associations + join_dependency.join_associations.each do |association| relation = association.join_relation(relation) end diff --git a/activerecord/lib/active_record/serialization.rb b/activerecord/lib/active_record/serialization.rb index 2bde06f562..be4354ce6a 100644 --- a/activerecord/lib/active_record/serialization.rb +++ b/activerecord/lib/active_record/serialization.rb @@ -37,7 +37,7 @@ module ActiveRecord #:nodoc: include_has_options = include_associations.is_a?(Hash) associations = include_has_options ? include_associations.keys : Array.wrap(include_associations) - for association in associations + associations.each do |association| records = case self.class.reflect_on_association(association).macro when :has_many, :has_and_belongs_to_many send(association).to_a diff --git a/activerecord/lib/rails/generators/active_record/model/templates/migration.rb b/activerecord/lib/rails/generators/active_record/model/templates/migration.rb index 4f81a52fd0..851930344a 100644 --- a/activerecord/lib/rails/generators/active_record/model/templates/migration.rb +++ b/activerecord/lib/rails/generators/active_record/model/templates/migration.rb @@ -1,7 +1,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration def change create_table :<%= table_name %> do |t| -<% for attribute in attributes -%> +<% attributes.each do |attribute| -%> t.<%= attribute.type %> :<%= attribute.name %> <% end -%> <% if options[:timestamps] %> |