Module: ErpTxnsAndAccts::Extensions::ActiveRecord::ActsAsBizTxnEvent::ClassMethods

Defined in:
lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_biz_txn_event ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb', line 11

def acts_as_biz_txn_event
  extend ActsAsBizTxnEvent::SingletonMethods
  include ActsAsBizTxnEvent::InstanceMethods

  after_initialize :initialize_biz_txn_event
  after_create :save_biz_txn_event
  after_update :save_biz_txn_event
  after_destroy :destroy_biz_txn_event

  has_one :biz_txn_event, :as => :biz_txn_record
  belongs_to :biz_txn_acct_root

  #from BizTxnEvent
  [:txn_type, :txn_type=,
   :txn_type_iid, :txn_type_iid=,
   :biz_txn_type_id, :biz_txn_type_id=,
   :external_id_source, :external_id_source=,
   :external_identifier, :external_identifier=,
   :description, :description=,
   :post_date, :post_date=,
   :created_at, :created_at=,
   :updated_at, :updated_at=,
   :create_dependent_txns, :account,
   #
   # has_tracked_status delegations
   #
   :has_status?, :had_status?, :has_had_status?, :get_status_for_date_time,
   :get_statuses_for_date_time_range, :current_status_application, :current_status_type,
   :current_status, :current_status=, :previous_status, :add_status
  ].each { |m| delegate m, :to => :biz_txn_event }
end