lib/npr/concern/relation.rb in npr-2.0.2 vs lib/npr/concern/relation.rb in npr-3.0.0
- old
+ new
@@ -82,10 +82,10 @@
def create_relations(json)
self.class._has_many_relations.each do |relation|
collection = []
if node = json[relation[:key]]
- node.each do |obj|
+ Array.wrap(node).each do |obj|
collection.push relation[:class_name].new(obj)
end
end
send "#{relation[:name]}=", collection