Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Credit < ActiveRecord::Base
- belongs_to :user
- belongs_to :debtor, :class_name => "User"
- def subtract_balance(amount)
- if value >= amount
- value -= amount
- return 0.0
- else
- result = amount - value
- value = 0.0
- return result
- end
- end
- end
Add Comment
Please, Sign In to add comment