diff --git a/app/models/spree/credit_card.rb b/app/models/spree/credit_card.rb index 7f6b41bcb4..948dcf829d 100644 --- a/app/models/spree/credit_card.rb +++ b/app/models/spree/credit_card.rb @@ -2,8 +2,6 @@ module Spree class CreditCard < ActiveRecord::Base - # Should be able to remove once we reach Spree v2.2.0 - # https://github.com/spree/spree/commit/411010f3975c919ab298cb63962ee492455b415c belongs_to :payment_method belongs_to :user diff --git a/app/models/spree/payment_method.rb b/app/models/spree/payment_method.rb index a799eaebdd..39df36486d 100644 --- a/app/models/spree/payment_method.rb +++ b/app/models/spree/payment_method.rb @@ -13,7 +13,7 @@ module Spree DISPLAY = [:both, :front_end, :back_end].freeze default_scope -> { where(deleted_at: nil) } - has_many :credit_cards, class_name: "Spree::CreditCard" # from Spree v.2.3.0 d470b31798f37 + has_many :credit_cards, class_name: "Spree::CreditCard" validates :name, presence: true validate :distributor_validation @@ -22,7 +22,6 @@ module Spree scope :production, -> { where(environment: 'production') } - # -- Scopes scope :managed_by, lambda { |user| if user.has_spree_role?('admin') where(nil) @@ -48,7 +47,6 @@ module Spree scope :by_name, -> { order('spree_payment_methods.name ASC') } - # Rewrite Spree's ruby-land class method as a scope scope :available, lambda { |display_on = 'both'| where(active: true). where('spree_payment_methods.display_on=? OR spree_payment_methods.display_on=? OR spree_payment_methods.display_on IS NULL', display_on, ''). @@ -70,14 +68,6 @@ module Spree raise 'You must implement payment_source_class method for this gateway.' end - def self.available(display_on = 'both') - all.select do |p| - p.active && - (p.display_on == display_on.to_s || p.display_on.blank?) && - (p.environment == Rails.env || p.environment.blank?) - end - end - def self.active? where(type: to_s, environment: Rails.env, active: true).count.positive? end