Skip to content

Instantly share code, notes, and snippets.

@tyronewilson
Last active February 22, 2017 13:49
Show Gist options
  • Save tyronewilson/109261b3cc98d6888f114162471b6186 to your computer and use it in GitHub Desktop.
Save tyronewilson/109261b3cc98d6888f114162471b6186 to your computer and use it in GitHub Desktop.
example bank account class
module Banking
module PaymentMethods
class BankAccount < ActiveRecord::Base
belongs_to :user
has_many :transactions, class_name: 'Banking::Transaction'
def debit(amount)
Processing::Debit.execute(amount, self)
# Or Processing::Debit.new(amount, self).process! depending on your desired API
end
def credit(amount)
Processing::Credit.execute(amount, self)
# Or Processing::Credit.new(amount, self).process!
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment