Sha256: 5b3d8d5a7c1235e218177b2fa6a71f42f6b5a2f071619bbee3c11ca026c8dc23

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

module Comee
  module Core
    class ClientAddress < ApplicationRecord
      SHIPPING_ADDRESS = "Shipping Address".freeze
      DELIVERY_ADDRESS = "Delivery Address".freeze
      INVOICING_ADDRESS = "Invoicing Address".freeze

      ADDRESS_TYPES = [SHIPPING_ADDRESS, DELIVERY_ADDRESS, INVOICING_ADDRESS].freeze

      belongs_to :client
      belongs_to :country, -> { where(lookup_type: :country) }, class_name: "Comee::Core::Lookup"

      validates :address_line1, :address_type, presence: true
      validates :address_type, inclusion: {in: ADDRESS_TYPES}
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
comee_core-0.2.75 app/models/comee/core/client_address.rb
comee_core-0.2.70 app/models/comee/core/client_address.rb
comee_core-0.2.69 app/models/comee/core/client_address.rb
comee_core-0.2.68 app/models/comee/core/client_address.rb