Skip to content

Commit

Permalink
Merge pull request #3388 from nebulab/spaghetticode/fix-deprecation-m…
Browse files Browse the repository at this point in the history
…essage

Fix deprecation message for Spree::CreditCard
  • Loading branch information
kennyadsl authored Oct 24, 2019
2 parents 0cc177b + 4c076f3 commit d323436
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/app/models/spree/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ def self.default
}.freeze

def default
Spree::Deprecation.warn("CreditCard.default is deprecated. Please use user.wallet.default_wallet_payment_source instead.", caller)
Spree::Deprecation.warn("CreditCard#default is deprecated. Please use user.wallet.default_wallet_payment_source instead.", caller)
return false if user.nil?
user.wallet.default_wallet_payment_source.try!(:payment_source) == self
end

def default=(set_as_default)
Spree::Deprecation.warn("CreditCard.default= is deprecated. Please use user.wallet.default_wallet_payment_source= instead.", caller)
Spree::Deprecation.warn("CreditCard#default= is deprecated. Please use user.wallet.default_wallet_payment_source= instead.", caller)
if user.nil?
raise "Cannot set 'default' on a credit card without a user"
elsif set_as_default # setting this card as default
Expand Down

0 comments on commit d323436

Please sign in to comment.