lib/apimaster/mapper.rb in apimaster-0.1.1 vs lib/apimaster/mapper.rb in apimaster-0.1.2
- old
+ new
@@ -59,10 +59,10 @@
record = {}
fields = self.class.find_attrs_in_options(:accessor, accessor)
fields.each do |field|
if self.respond_to?(field)
val = self.send(field)
- record[field] = val.respond_to?(:to_hash) ? val.to_hash(accessor) : val
+ record[field] = (val.respond_to?(:to_hash) and not val.is_a?(Hash)) ? val.to_hash(accessor) : val
else
raise "Dataset #{self.class} has no method with the name of #{field}"
end
end
record