Class: AuditLogType
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AuditLogType
- Defined in:
- app/models/audit_log_type.rb
Overview
create_table :audit_log_types do |t|
t.string :description
t.string :error_code
t.string :comments
t.string :internal_identifier
t.string :external_identifier
t.string :external_id_source
# awesome nested set columns
t.integer :parent_id
t.integer :lft
t.integer :rgt
t.timestamps
end
add_index :audit_log_types, :internal_identifier, :name => 'audit_log_types_internal_identifier_idx'
add_index :audit_log_types, :parent_id, :name => 'audit_log_types_parent_id_idx'
Class Method Summary collapse
-
.find_by_type_and_subtype_iid(txn_type, txn_subtype) ⇒ Object
find by type Internal Identifier and subtype Internal Identifier.
Methods included from ErpTechSvcs::Utils::DefaultNestedSetMethods
#children_to_tree_hash, included, #is_descendant_of?, #leaf, #to_json_with_leaf, #to_label, #to_record_representation, #to_representation, #to_tree_hash
Class Method Details
.find_by_type_and_subtype_iid(txn_type, txn_subtype) ⇒ Object
find by type Internal Identifier and subtype Internal Identifier
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/audit_log_type.rb', line 30 def self.find_by_type_and_subtype_iid(txn_type, txn_subtype) result = nil txn_type_recs = find_all_by_internal_identifier(txn_type.strip) 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) result = txn_subtype_rec unless txn_subtype_rec.nil? result = txn_subtype_rec break end end unless txn_type_recs.blank? result end |