Class: TopicPolicy

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

Instance Attribute Summary

Attributes inherited from ApplicationPolicy

#record, #user

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#destroy_all?, #index?, #initialize, #scope, #show?

Constructor Details

This class inherits a constructor from ApplicationPolicy

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/policies/topic_policy.rb', line 7

def create?
  true
end

#destroy?Boolean

Returns:

  • (Boolean)


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

def destroy?
  update?
end

#edit?Boolean

Returns:

  • (Boolean)


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

def edit?
  update?
end

#new?Boolean

Returns:

  • (Boolean)


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

def new?
  create?
end

#update?Boolean

Returns:

  • (Boolean)


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

def update?
  record.editable_by?(user)
end