app/models/dorsale/expense_gun/expense.rb in dorsale-3.8.1 vs app/models/dorsale/expense_gun/expense.rb in dorsale-3.9.0
- old
+ new
@@ -22,11 +22,11 @@
default_scope -> {
order(created_at: :desc, id: :desc)
}
def assign_default_values
- assign_default :date, Time.zone.now.to_date
+ assign_default :date, Date.current
end
# Sum of line amounts
def total_all_taxes
expense_lines.map(&:total_all_taxes).sum
@@ -40,13 +40,11 @@
# Sum of deductible deductible vat
def total_vat_deductible
expense_lines.map(&:total_vat_deductible).sum
end
- def current_state
- aasm.current_state
- end
+ delegate :current_state, to: :aasm
aasm(column: :state, whiny_transitions: false) do
state :draft, initial: true
state :submitted
state :accepted
@@ -71,7 +69,6 @@
end
def may_edit?
current_state == :draft
end
-
end