Skip to content

Commit

Permalink
Fix issues on ruby 1.9 due to lack of String#each
Browse files Browse the repository at this point in the history
*_to_many associations can have singular values, indicating they
only have a single associated object, so work with both
single objects and arrays of objects correctly.
  • Loading branch information
jeremyevans committed Jun 4, 2012
1 parent 85bdd58 commit 889e096
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/fixture_dependencies.rb
Expand Up @@ -190,8 +190,8 @@ def use(record, loading = [], procs = {})
use(dep_name, loading, procs)
value = get(dep_name)
end
elsif
many_associations << [attr, reflection, model_method(:reflection_type, mtype, reflection) == :has_one ? [value] : value]
else
many_associations << [attr, reflection, value]
next
end
end
Expand All @@ -213,7 +213,7 @@ def use(record, loading = [], procs = {})
end
# Update the has_many and habtm associations
many_associations.each do |attr, reflection, values|
values.each do |value|
Array(values).each do |value|
dep_name = "#{model_method(:reflection_class, mtype, reflection).name.underscore}__#{value}".to_sym
rtype = model_method(:reflection_type, mtype, reflection) if verbose > 1
if dep_name == record
Expand Down

0 comments on commit 889e096

Please sign in to comment.