Sha256: 45389bdc8d3ba642a308ce9bab350e57f53925296632a15fb3f67ca1345087ee

Contents?: true

Size: 432 Bytes

Versions: 12

Compression:

Stored size: 432 Bytes

Contents

module Spree
  class RoleUser < ActiveRecord::Base
    self.table_name = "spree_roles_users"
    belongs_to :role, class_name: "Spree::Role"
    belongs_to :user, class_name: Spree::UserClassHandle.new

    after_save :generate_admin_api_key

    private

    def generate_admin_api_key
      if role.admin? && user.respond_to?(:spree_api_key) && !user.spree_api_key
        user.generate_spree_api_key!
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
solidus_core-1.0.7 app/models/spree/role_user.rb
solidus_core-1.0.6 app/models/spree/role_user.rb
solidus_core-1.0.5 app/models/spree/role_user.rb
solidus_core-1.0.4 app/models/spree/role_user.rb
solidus_core-1.0.3 app/models/spree/role_user.rb
solidus_core-1.0.2 app/models/spree/role_user.rb
solidus_core-1.0.1 app/models/spree/role_user.rb
solidus_core-1.0.0 app/models/spree/role_user.rb
solidus_core-1.0.0.rc2 app/models/spree/role_user.rb
solidus_core-1.0.0.rc1 app/models/spree/role_user.rb
solidus_core-1.0.0.pre3 app/models/spree/role_user.rb
solidus_core-1.0.0.pre2 app/models/spree/role_user.rb