Class: ApplicationPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/pundit/install/templates/application_policy.rb

Defined Under Namespace

Classes: Scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, record) ⇒ ApplicationPolicy

Returns a new instance of ApplicationPolicy.


6
7
8
9
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 6

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

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record


4
5
6
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 4

def record
  @record
end

#userObject (readonly)

Returns the value of attribute user


4
5
6
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 4

def user
  @user
end

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)

19
20
21
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 19

def create?
  false
end

#destroy?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 35

def destroy?
  false
end

#edit?Boolean

Returns:

  • (Boolean)

31
32
33
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 31

def edit?
  update?
end

#index?Boolean

Returns:

  • (Boolean)

11
12
13
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 11

def index?
  false
end

#new?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 23

def new?
  create?
end

#show?Boolean

Returns:

  • (Boolean)

15
16
17
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 15

def show?
  false
end

#update?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'lib/generators/pundit/install/templates/application_policy.rb', line 27

def update?
  false
end