Sha256: 08ebf122cc98a5136a3a8c7ca6a32be1b58ae1818d3840bd6dcc86674c924d66

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

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

    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
  end
end

::Spree::Address.prepend(Spree::AddressDecorator)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_braintree_vzero-3.5.1 app/models/spree/address_decorator.rb