Class: LedgerAccountable::LedgerItem::EntryCreator
- Inherits:
-
Object
- Object
- LedgerAccountable::LedgerItem::EntryCreator
- Defined in:
- lib/ledger_accountable/ledger_item/entry_creator.rb
Overview
Creates a single LedgerEntry.
Class Method Summary collapse
Class Method Details
.create(item:, owner:, amount:, type:, entry_type:, metadata: {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ledger_accountable/ledger_item/entry_creator.rb', line 7 def self.create(item:, owner:, amount:, type:, entry_type:, metadata: {}) LedgerEntry.create!( # create! will raise if the ledger entry fails to be created, # which will rollback the attempt to save the LedgerAccountable object owner: owner, ledger_item: item, transaction_type: type, entry_type: entry_type, amount_cents: amount, metadata: ) end |