Class: RepresentationPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- RepresentationPolicy
- Defined in:
- app/policies/representation_policy.rb
Overview
Protects Representation objects
Instance Method Summary collapse
-
#create? ⇒ Boolean
(also: #new?)
Whether or not the user can create representations for this organization.
-
#index? ⇒ true
Everyone can list representations in their organizations.
-
#show? ⇒ true
Anyone can view an representation belonging to their organization.
-
#update? ⇒ Boolean
(also: #edit?, #destroy?)
If the user can change the representation.
Methods inherited from ApplicationPolicy
Constructor Details
This class inherits a constructor from ApplicationPolicy
Instance Method Details
#create? ⇒ Boolean Also known as: new?
Returns whether or not the user can create representations for this organization
16 17 18 |
# File 'app/policies/representation_policy.rb', line 16 def create? organization_user. end |
#index? ⇒ true
Returns everyone can list representations in their organizations
6 7 8 |
# File 'app/policies/representation_policy.rb', line 6 def index? true end |
#show? ⇒ true
Returns anyone can view an representation belonging to their organization
11 12 13 |
# File 'app/policies/representation_policy.rb', line 11 def show? true end |
#update? ⇒ Boolean Also known as: edit?, destroy?
Returns if the user can change the representation
23 24 25 26 |
# File 'app/policies/representation_policy.rb', line 23 def update? return true if organization_user.editor? organization_user. && organization_user == record. end |