lib/xsys/model/transaction.rb in xsys-0.0.25 vs lib/xsys/model/transaction.rb in xsys-0.0.26
- old
+ new
@@ -10,10 +10,10 @@
def initialize(attributes={})
attributes.each do |k,v|
if k.to_s == 'transaction_date'
self.transaction_date = Date.parse(v) unless v.nil?
elsif k.to_s == 'user'
- self.user = User.new(v)
+ self.user = User.new(v) unless v.nil?
elsif k.to_s == 'items'
self.items = v.map { |x| TransactionItem.new(x) }
else
self.send("#{k}=", v) if self.respond_to?(k)
end