提交 9b1a4fda 编写于 作者: A Aaron Patterson

fix case / when indentation

上级 27be7778
......@@ -1951,27 +1951,27 @@ def build_join_association(reflection, parent)
def construct(parent, associations, joins, row)
case associations
when Symbol, String
join = joins.detect{|j| j.reflection.name.to_s == associations.to_s && j.parent_table_name == parent.class.table_name }
when Symbol, String
join = joins.detect{|j| j.reflection.name.to_s == associations.to_s && j.parent_table_name == parent.class.table_name }
raise(ConfigurationError, "No such association") if join.nil?
joins.delete(join)
construct_association(parent, join, row)
when Array
associations.each do |association|
construct(parent, association, joins, row)
end
when Hash
associations.sort_by { |k,_| k.to_s }.each do |name, assoc|
join = joins.detect{|j| j.reflection.name.to_s == name.to_s && j.parent_table_name == parent.class.table_name }
raise(ConfigurationError, "No such association") if join.nil?
association = construct_association(parent, join, row)
joins.delete(join)
construct_association(parent, join, row)
when Array
associations.each do |association|
construct(parent, association, joins, row)
end
when Hash
associations.sort_by { |k,_| k.to_s }.each do |name, assoc|
join = joins.detect{|j| j.reflection.name.to_s == name.to_s && j.parent_table_name == parent.class.table_name }
raise(ConfigurationError, "No such association") if join.nil?
association = construct_association(parent, join, row)
joins.delete(join)
construct(association, assoc, joins, row) if association
end
else
raise ConfigurationError, associations.inspect
construct(association, assoc, joins, row) if association
end
else
raise ConfigurationError, associations.inspect
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册