Class: ApplicationPolicy

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

Overview

Default generated policies

Defined Under Namespace

Classes: Scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, record) ⇒ ApplicationRecord

Initializer

Parameters:


14
15
16
17
# File 'app/policies/application_policy.rb', line 14

def initialize(user, record)
  @user = user
  @record = record
end

Instance Attribute Details

#recordObject (readonly)

`ApplicationRecord` to which try to access


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

def record
  @record
end

#userObject (readonly)

Who try to access record.


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

def user
  @user
end

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'app/policies/application_policy.rb', line 27

def create?
  false
end

#destroy?Boolean

Returns:

  • (Boolean)

43
44
45
# File 'app/policies/application_policy.rb', line 43

def destroy?
  false
end

#edit?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'app/policies/application_policy.rb', line 39

def edit?
  update?
end

#index?Boolean

Returns:

  • (Boolean)

19
20
21
# File 'app/policies/application_policy.rb', line 19

def index?
  false
end

#new?Boolean

Returns:

  • (Boolean)

31
32
33
# File 'app/policies/application_policy.rb', line 31

def new?
  create?
end

#show?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'app/policies/application_policy.rb', line 23

def show?
  false
end

#update?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'app/policies/application_policy.rb', line 35

def update?
  false
end