Skip to content

Commit

Permalink
Merge pull request #1680 from jhawthorn/deprecate_address_empty
Browse files Browse the repository at this point in the history
Deprecate Spree::Address#empty?
  • Loading branch information
jhawthorn authored Jan 16, 2017
2 parents dea63f4 + 2638d1b commit 8ae8ec4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/app/models/spree/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,28 @@ def ==(other_address)
end

def same_as?(other_address)
Spree::Deprecation.warn("Address.same_as? is deprecated. It's equivalent to Address.==", caller)
Spree::Deprecation.warn("Address#same_as? is deprecated. It's equivalent to Address.==", caller)
self == other_address
end

def same_as(other_address)
Spree::Deprecation.warn("Address.same_as is deprecated. It's equivalent to Address.==", caller)
Spree::Deprecation.warn("Address#same_as is deprecated. It's equivalent to Address.==", caller)
self == other_address
end

# @deprecated Do not use this
def empty?
Spree::Deprecation.warn("Address#empty? is deprecated.", caller)
attributes.except('id', 'created_at', 'updated_at', 'country_id').all? { |_, v| v.nil? }
end

# This exists because the default Object#blank?, checks empty? if it is
# defined, and we have defined empty.
# This should be removed once empty? is removed
def blank?
false
end

# @return [Hash] an ActiveMerchant compatible address hash
def active_merchant_hash
{
Expand Down

0 comments on commit 8ae8ec4

Please sign in to comment.