Class: Renalware::Pathology::MeasurementUnit
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Renalware::Pathology::MeasurementUnit
- Defined in:
- app/models/renalware/pathology/measurement_unit.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#title ⇒ Object
A friendly string containing name and description (if present) in parentheses e.g.
Class Method Details
.for_collection_select ⇒ Object
12 13 14 |
# File 'app/models/renalware/pathology/measurement_unit.rb', line 12 def self.for_collection_select order(:name).select(:id, :name, :description).map { |row| [row.title, row.id] } end |
Instance Method Details
#title ⇒ Object
A friendly string containing name and description (if present) in parentheses e.g. “l (litres)”
18 19 20 21 22 |
# File 'app/models/renalware/pathology/measurement_unit.rb', line 18 def title return name if description.blank? || name == description "#{name} (#{description})" end |