Sha256: 7673ec4efd26ed4bc0d8f14bf6597257f1c6af4457df444825b28138f4c3c4e9

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 Bytes

Contents

module Addresses::Base
  extend ActiveSupport::Concern

  included do
    belongs_to :addressable, polymorphic: true
    belongs_to :country, class_name: "Addresses::Country"
    belongs_to :region, class_name: "Addresses::Region"

    def valid_address?
      address_one? && city? && region_id? && country_id? && postal_code?
    end

    def all_blank?(attributes = {})
      return super unless attributes.empty?
      !(address_one? || address_two? || city? || region_id? || country_id? || postal_code?)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bullet_train-1.14.0 app/models/concerns/addresses/base.rb