Module: Spree::AddressDecorator

Defined in:
app/models/spree/address_decorator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



3
4
5
6
7
8
9
# File 'app/models/spree/address_decorator.rb', line 3

def self.prepended(base)
  base.scope :vaulted_duplicates, ->(address) do
    base.where.not(id: address.id).
      where.not(braintree_id: nil).
      where(address.attributes.except('id', 'updated_at', 'created_at', 'braintree_id', 'preferences'))
  end
end

Instance Method Details

#same_as?(other) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'app/models/spree/address_decorator.rb', line 11

def same_as?(other)
  return false if other.nil?
  attributes.except('id', 'updated_at', 'created_at', 'braintree_id') == other.attributes.except('id', 'updated_at', 'created_at', 'braintree_id')
end