Class: HunterPolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/hunter_policy.rb

Overview

This controls access to Hunters

Defined Under Namespace

Classes: Scope

Instance Attribute Summary

Attributes inherited from ApplicationPolicy

#record, #user

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#edit?, #index?, #initialize, #new?, #show?

Constructor Details

This class inherits a constructor from ApplicationPolicy

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)

5
6
7
8
# File 'app/policies/hunter_policy.rb', line 5

def create?
  return false unless @user && !@user.banned?
  true
end

#destroy?Boolean

Returns:

  • (Boolean)

15
16
17
18
# File 'app/policies/hunter_policy.rb', line 15

def destroy?
  return false unless @user
  @record.user == @user || @user.admin?
end

#update?Boolean

Returns:

  • (Boolean)

10
11
12
13
# File 'app/policies/hunter_policy.rb', line 10

def update?
  return false unless @user
  @record.user == @user || @user.admin?
end