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.6.31 app/models/concerns/addresses/base.rb
bullet_train-1.6.30 app/models/concerns/addresses/base.rb
bullet_train-1.6.29 app/models/concerns/addresses/base.rb
bullet_train-1.6.28 app/models/concerns/addresses/base.rb
bullet_train-1.6.27 app/models/concerns/addresses/base.rb
bullet_train-1.6.26 app/models/concerns/addresses/base.rb
bullet_train-1.6.25 app/models/concerns/addresses/base.rb
bullet_train-1.6.24 app/models/concerns/addresses/base.rb
bullet_train-1.6.23 app/models/concerns/addresses/base.rb
bullet_train-1.6.22 app/models/concerns/addresses/base.rb
bullet_train-1.6.21 app/models/concerns/addresses/base.rb
bullet_train-1.6.20 app/models/concerns/addresses/base.rb
bullet_train-1.6.19 app/models/concerns/addresses/base.rb
bullet_train-1.6.18 app/models/concerns/addresses/base.rb
bullet_train-1.6.17 app/models/concerns/addresses/base.rb
bullet_train-1.6.16 app/models/concerns/addresses/base.rb
bullet_train-1.6.15 app/models/concerns/addresses/base.rb
bullet_train-1.6.14 app/models/concerns/addresses/base.rb
bullet_train-1.6.13 app/models/concerns/addresses/base.rb
bullet_train-1.6.12 app/models/concerns/addresses/base.rb