Permalink
Browse files

Merge pull request #1161 from guilleiguaran/each_syntax_in_activerecord

Syntax cleanup:  for in => each on ActiveRecord
  • Loading branch information...
2 parents 54823fe + 1592130 commit 5b8bc4613c179e92f1887b9f6d80898e6dd7108c @fxn fxn committed May 20, 2011
@@ -2018,7 +2018,7 @@ def extract_max_param_for_multiparameter_attributes(values_hash_from_param, uppe
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)
@@ -226,7 +226,7 @@ def construct_relation_for_association_find(join_dependency)
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
@@ -37,7 +37,7 @@ def serializable_add_includes(options = {})
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
@@ -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] %>

0 comments on commit 5b8bc46

Please sign in to comment.