foodsoft/app/models/financial_transaction.rb
benni 8a74e7d77f Removed annoate and hirb Gemfiles.
Annotate: Better look in schema.rb, this reference should be always up
to date.

Hirb: To reactivate hirb, look in railscasts:
http://railscasts.com/episodes/48-console-tricks-revised
2012-07-27 18:07:42 +02:00

17 lines
538 B
Ruby

# financial transactions are the foodcoop internal financial transactions
# only ordergroups have an account balance and are happy to transfer money
class FinancialTransaction < ActiveRecord::Base
belongs_to :ordergroup
belongs_to :user
validates_presence_of :amount, :note, :user_id, :ordergroup_id
validates_numericality_of :amount
localize_input_of :amount
# Use this save method instead of simple save and after callback
def add_transaction!
ordergroup.add_financial_transaction! amount, note, user
end
end