app/models/esa/ruleset.rb in event_sourced_accounting-0.2.2 vs app/models/esa/ruleset.rb in event_sourced_accounting-0.2.3
- old
+ new
@@ -213,11 +213,11 @@
amounts.map{|a| a.dup.merge({amount: BigDecimal(0) - a[:amount]}) }
end
def find_account(type, name)
if self.chart.present? and Account.valid_type?(type)
- self.chart.accounts.
- where(:type => Account.namespaced_type(type), :name => name).
+ Account.namespaced_type(type).constantize.
+ where(:chart_id => self.chart, :name => name).
first_or_create
end
end
private