Class: BizTxnType
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- BizTxnType
- Includes:
- ErpTechSvcs::Utils::DefaultNestedSetMethods
- Defined in:
- app/models/biz_txn_type.rb
Class Method Summary collapse
-
.find_by_type_and_subtype(txn_type, txn_subtype) ⇒ Object
this method handles default behavior for find by type and subtype.
-
.find_by_type_and_subtype_eid(txn_type, txn_subtype) ⇒ Object
find by type External Identifier and subtype External Identifier.
-
.find_by_type_and_subtype_iid(txn_type, txn_subtype) ⇒ Object
find by type Internal Identifier and subtype Internal Identifier.
-
.find_child_types(biz_txn_types) ⇒ Object
finds all child for given types.
Instance Method Summary collapse
Class Method Details
.find_by_type_and_subtype(txn_type, txn_subtype) ⇒ Object
this method handles default behavior for find by type and subtype
11 12 13 |
# File 'app/models/biz_txn_type.rb', line 11 def self.find_by_type_and_subtype(txn_type, txn_subtype) return self.find_by_type_and_subtype_eid(txn_type, txn_subtype) end |
.find_by_type_and_subtype_eid(txn_type, txn_subtype) ⇒ Object
find by type External Identifier and subtype External Identifier
27 28 29 30 31 32 33 34 35 |
# File 'app/models/biz_txn_type.rb', line 27 def self.find_by_type_and_subtype_eid(txn_type, txn_subtype) txn_type_recs = find_all_by_external_identifier(txn_type.strip) return nil if txn_type_recs.blank? txn_type_recs.each do |txn_type_rec| txn_subtype_rec = find_by_parent_id_and_external_identifier(txn_type_rec.id, txn_subtype.strip) return txn_subtype_rec unless txn_subtype_rec.nil? end return nil end |
.find_by_type_and_subtype_iid(txn_type, txn_subtype) ⇒ Object
find by type Internal Identifier and subtype Internal Identifier
16 17 18 19 20 21 22 23 24 |
# File 'app/models/biz_txn_type.rb', line 16 def self.find_by_type_and_subtype_iid(txn_type, txn_subtype) txn_type_recs = find_all_by_internal_identifier(txn_type.strip) return nil if txn_type_recs.blank? txn_type_recs.each do |txn_type_rec| txn_subtype_rec = find_by_parent_id_and_internal_identifier(txn_type_rec.id, txn_subtype.strip) return txn_subtype_rec unless txn_subtype_rec.nil? end return nil end |
.find_child_types(biz_txn_types) ⇒ Object
finds all child for given types.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/models/biz_txn_type.rb', line 41 def self.find_child_types(biz_txn_types) all_biz_txn_types = [] biz_txn_types.each do |biz_txn_type| if biz_txn_type.is_a?(String) biz_txn_type = BizTxnType.iid(biz_txn_type) end all_biz_txn_types.concat biz_txn_type.self_and_descendants end all_biz_txn_types.flatten end |
Instance Method Details
#to_data_hash ⇒ Object
56 57 58 |
# File 'app/models/biz_txn_type.rb', line 56 def to_data_hash to_hash(:only => [:id, :description, :internal_identifier, :created_at, :updated_at]) end |