Sha256: ab70d324cdb5eff91bda8e6b4fd613fc37f675e308dc7a8024abd6a95df1c114

Contents?: true

Size: 918 Bytes

Versions: 62

Compression:

Stored size: 918 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

62 entries across 62 versions & 1 rubygems

Version Path
renalware-core-2.0.77 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.76 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.75 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.74 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.73 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.72 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.71 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.70 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.69 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.68 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.67 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.64 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.63 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.62 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.61 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.60 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.58 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.57 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.56 app/models/renalware/pd/bag_type.rb
renalware-core-2.0.55 app/models/renalware/pd/bag_type.rb