foodsoft/app/models/financial_transaction.rb
Benjamin Meichsner 9f8d0d28ac Removed gettext and simplified_localization-plugin. L18n is now the appropriate module.
Upgraded to rails 2.2.2 and replaced complex foodsoft.rb-loader with simple
initializers/load_app_config.rb. Multiple foodcoops option is temporarly deactivated.
2009-01-06 15:45:19 +01:00

21 lines
701 B
Ruby

# financial transactions are the foodcoop internal financial transactions
# only order_groups have an account balance and are happy to transfer money
#
# financial transaction have the following attributes:
# * order_group_id (int)
# * amount (decimal)
# * note (text)
# * created_on (datetime)
class FinancialTransaction < ActiveRecord::Base
belongs_to :order_group
belongs_to :user
validates_presence_of :note, :user_id, :order_group_id
validates_numericality_of :amount
# Custom attribute setter that accepts decimal numbers using localized decimal separator.
def amount=(amount)
self[:amount] = String.delocalized_decimal(amount)
end
end