Sha256: 9333b9073031e455dbe3ceb99344c477ba98789700208a1ef195bb9e65c1e020

Contents?: true

Size: 539 Bytes

Versions: 91

Compression:

Stored size: 539 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(attributes) unless attributes.empty?
      !(address_one? || address_two? || city? || region_id? || country_id? || postal_code?)
    end
  end
end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
bullet_train-1.13.0 app/models/concerns/addresses/base.rb
bullet_train-1.12.3 app/models/concerns/addresses/base.rb
bullet_train-1.12.2 app/models/concerns/addresses/base.rb
bullet_train-1.12.1 app/models/concerns/addresses/base.rb
bullet_train-1.12.0 app/models/concerns/addresses/base.rb
bullet_train-1.11.0 app/models/concerns/addresses/base.rb
bullet_train-1.10.0 app/models/concerns/addresses/base.rb
bullet_train-1.9.0 app/models/concerns/addresses/base.rb
bullet_train-1.8.5 app/models/concerns/addresses/base.rb
bullet_train-1.8.4 app/models/concerns/addresses/base.rb
bullet_train-1.8.3 app/models/concerns/addresses/base.rb
bullet_train-1.8.2 app/models/concerns/addresses/base.rb
bullet_train-1.8.1 app/models/concerns/addresses/base.rb
bullet_train-1.8.0 app/models/concerns/addresses/base.rb
bullet_train-1.7.23 app/models/concerns/addresses/base.rb
bullet_train-1.7.22 app/models/concerns/addresses/base.rb
bullet_train-1.7.21 app/models/concerns/addresses/base.rb
bullet_train-1.7.20 app/models/concerns/addresses/base.rb
bullet_train-1.7.19 app/models/concerns/addresses/base.rb
bullet_train-1.7.18 app/models/concerns/addresses/base.rb