app/models/stripe_local/transfer.rb in stripe_local-0.2.0 vs app/models/stripe_local/transfer.rb in stripe_local-0.2.1
- old
+ new
@@ -6,12 +6,12 @@
self.primary_key = :id
time_writer :date
- def metadata= hash
- MultiJson.dump hash
+ def metadata= so
+ MultiJson.dump so.to_hash
end
def metadata
MultiJson.load read_attribute( :metadata ), symbolize_keys: true
end
@@ -24,9 +24,10 @@
def normalize attrs
attrs.each_with_object({}) do |(k,v),h|
key = case k.to_sym
when :balance_transaction then :transaction_id
when :date then h[:date] = Time.at(v) and next
+ when :metadata then h[:metadata] = MultiJson.dump( v.to_hash ) and next
when ->(x){attribute_method? x} then k.to_sym
else next
end
h[key] = v
end
\ No newline at end of file