Class: Ecom::Core::MeasurementUnit
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Ecom::Core::MeasurementUnit
- Defined in:
- app/models/ecom/core/measurement_unit.rb
Constant Summary collapse
- METRIC =
'Metric'.freeze
- IMPERIAL =
'Imperial'.freeze
- SYSTEM_OF_MEASURMENT =
[METRIC, IMPERIAL].freeze
- LENGTH =
commonly used physical quantities in construction
'Length'.freeze
- MASS =
'Mass'.freeze
- TIME =
'Time'.freeze
- CURRENT =
'Current'.freeze
- TEMPRATURE =
'Temprature'.freeze
- AREA =
'Area'.freeze
- VOLUME =
'Volume'.freeze
- ENERGY =
'Energy'.freeze
- DENSITY =
'DENSITY'.freeze
- PHYSICAL_QUANTITIES =
[LENGTH, MASS, TIME, CURRENT, TEMPRATURE, AREA, VOLUME, ENERGY, DENSITY].freeze
Instance Method Summary collapse
Instance Method Details
#si_unit_with_conversion_factor ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/models/ecom/core/measurement_unit.rb', line 36 def si_unit_with_conversion_factor if is_si_unit && conversion_factor != 1 errors.add(:base, 'Conversion factor for an SI unit has to be 1') elsif !is_si_unit && conversion_factor == 1 errors.add(:base, 'Only SI units can have a conversion factor 1') end end |