Sha256: ccf9d34ead51b03f360d7cf8c12a7eeba7eba073c41107b5a93ca4d0dfd0107a
Contents?: true
Size: 749 Bytes
Versions: 15
Compression:
Stored size: 749 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/pathology" module Renalware module Pathology class MeasurementUnit < ApplicationRecord validates :name, presence: true has_many :observation_descriptions, inverse_of: :measurement_unit belongs_to :ukrdc_measurement_unit, class_name: "Renalware::UKRDC::MeasurementUnit" def self.for_collection_select order(:name).select(:id, :name, :description).map { |row| [row.title, row.id] } end # A friendly string containing name and description (if present) in parentheses # e.g. "l (litres)" def title return name if description.blank? || name == description "#{name} (#{description})" end end end end
Version data entries
15 entries across 15 versions & 1 rubygems