module ErpTxnsAndAccts::Extensions::ActiveRecord::ActsAsBizTxnEvent::InstanceMethods

Public Instance Methods

account=(acct) click to toggle source

allow for a client to pass either an account root or a polymorphic subclass of account root, but always set the account to the root

# File lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb, line 61
def account=(acct)
  if acct.instance_of?(BizTxnAcctRoot)
    self.biz_txn_event.biz_txn_acct_root = (acct)
  else
    self.biz_txn_event.biz_txn_acct_root = (acct.biz_txn_acct_root)
  end
end
destroy_biz_txn_event() click to toggle source
# File lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb, line 81
def destroy_biz_txn_event
  self.biz_txn_event.destroy if (self.biz_txn_event && !self.biz_txn_event.frozen?)
end
initialize_biz_txn_event() click to toggle source
# File lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb, line 73
def initialize_biz_txn_event
  if self.new_record? and self.biz_txn_event.nil?
    t = BizTxnEvent.new
    self.biz_txn_event = t
    t.biz_txn_record = self
  end
end
root_txn() click to toggle source
# File lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb, line 55
def root_txn
  self.biz_txn_event
end
save_biz_txn_event() click to toggle source
# File lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb, line 69
def save_biz_txn_event
  self.biz_txn_event.save
end