Class: ApplicationPolicy

Inherits:
Struct
  • Object
show all
Defined in:
app/policies/application_policy.rb

Overview

Default admin-only authorization policy.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resourceObject

Returns the value of attribute resource

Returns:

  • (Object)

    the current value of resource


2
3
4
# File 'app/policies/application_policy.rb', line 2

def resource
  @resource
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user


2
3
4
# File 'app/policies/application_policy.rb', line 2

def user
  @user
end

Instance Method Details

#create?Boolean Also known as: new?

Returns:

  • (Boolean)

3
4
5
# File 'app/policies/application_policy.rb', line 3

def create?
  admin?
end

#destroy?Boolean

Returns:

  • (Boolean)

8
9
10
# File 'app/policies/application_policy.rb', line 8

def destroy?
  admin?
end

#show?Boolean Also known as: index?

Returns:

  • (Boolean)

12
13
14
# File 'app/policies/application_policy.rb', line 12

def show?
  admin?
end

#update?Boolean Also known as: edit?

Returns:

  • (Boolean)

17
18
19
# File 'app/policies/application_policy.rb', line 17

def update?
  admin?
end