lib/clean_model/attribute.rb in clean_model-0.0.1 vs lib/clean_model/attribute.rb in clean_model-0.0.2
- old
+ new
@@ -18,12 +18,16 @@
obj = klass.new
obj.assign_attributes value
obj
elsif value.is_a?(Array) && collection_class.new.respond_to?(:assign_attributes)
value.map do |v|
- obj = collection_class.new
- obj.assign_attributes v
- obj
+ if v.is_a? collection_class
+ v
+ else
+ obj = collection_class.new
+ obj.assign_attributes v
+ obj
+ end
end
else
value
end
end
\ No newline at end of file