Sha256: 0b7b4ec3bba03fc02ae994e67263d5b3e3688463f5ee9025b5b37735fdf7cea7

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

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

    self.table_name = 'spree_users'

    # for url generation
    def self.model_name
      ActiveModel::Name.new(self, nil, "User")
    end

    has_many :orders, foreign_key: :user_id

    before_destroy :check_completed_orders

    def has_spree_role?(role)
      true
    end

    def self.model_name
      ActiveModel::Name.new Spree::LegacyUser, Spree, 'user'
    end

    attr_accessor :password
    attr_accessor :password_confirmation

    private

      def check_completed_orders
        raise Spree::Core::DestroyWithOrdersError if orders.complete.present?
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_core-1.0.0.pre app/models/spree/legacy_user.rb