Class: HarmonizationCode

Inherits:
ApplicationRecord show all
Defined in:
app/models/harmonization_code.rb

Overview

== Schema Information

Table name: harmonization_codes
Database name: primary

id :bigint not null, primary key
description :string not null
hscode :string not null
level :integer not null
parent :string not null
section :string not null

Indexes

index_harmonization_codes_on_hscode (hscode) UNIQUE
index_harmonization_codes_on_level (level)
index_harmonization_codes_on_parent (parent)
index_harmonization_codes_on_section (section)

Class Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Class Method Details

.get_description_from_hscode(hscode) ⇒ Object



21
22
23
# File 'app/models/harmonization_code.rb', line 21

def self.get_description_from_hscode(hscode)
  HarmonizationCode.where(hscode: hscode.gsub(".","")).first&.description
end