Sha256: 7f711fe9969a798e067d86b028dbfce82b70f9b1d18c84eeafad21c950470574

Contents?: true

Size: 919 Bytes

Versions: 87

Compression:

Stored size: 919 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/pd"

module Renalware
  module PD
    class BagType < ApplicationRecord
      acts_as_paranoid
      extend Enumerize

      scope :ordered, -> { order(manufacturer: :asc, description: :asc) }

      enumerize :glucose_strength, in: { not_applicable: 0, low: 1, medium: 2, high: 3 }

      has_many :bags, class_name: "Renalware::PD::RegimeBag"

      validates :manufacturer, presence: true
      validates :description, presence: true
      validates :glucose_strength, presence: true

      validates :glucose_content,
                numericality: {
                  allow_nil: true,
                  greater_than_or_equal_to: 0,
                  less_than_or_equal_to: 50
                }

      def self.policy_class
        BasePolicy
      end

      def full_description
        [manufacturer, description].join(" ")
      end
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/pd/bag_type.rb
renalware-core-2.1.0 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.167 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.166 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.165 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.164 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.163 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.162 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.161 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.160 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.159 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.158 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.157 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.156 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.155 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.153 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.152 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.151 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.149 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.148 app/models/renalware/pd/bag_type.rb