100% free for Open Source, forever. Get another set of eyes on your code.

100% free for Open Source, forever. Get another set of eyes on your code.

aa8796c2
A

Spree::LegacyUser

Updated more than 3 months ago.

No issues here.

Congrats! Give yourself time to reflect on your awesome coding skillz.

# Default implementation of User.  This class is intended to be modified by extensions (ex. spree_auth_devise)
module Spree
  class LegacyUser < Spree::Base
    include UserAddress
    include UserPaymentSource

    self.table_name = 'spree_users'

    has_many :orders, foreign_key: :user_id

    before_destroy :check_completed_orders

    def has_spree_role?(role)
      true
    end

    attr_accessor :password
    attr_accessor :password_confirmation

    private

      def check_completed_orders
        raise Spree::Core::DestroyWithOrdersError if orders.complete.present?
      end
  end
end
14
Complexity
0
Duplication
26
Lines
2
Methods
6.9
Complexity / M
0
Churn
18
Lines of Code
9
LOC / Method