Class: Trek::PagePolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- Trek::PagePolicy
- Defined in:
- app/policies/trek/page_policy.rb
Direct Known Subclasses
Instance Method Summary collapse
- #create? ⇒ Boolean
- #destroy? ⇒ Boolean
- #index? ⇒ Boolean
- #manage? ⇒ Boolean
- #permitted_attributes ⇒ Object
Instance Method Details
#create? ⇒ Boolean
9 10 11 |
# File 'app/policies/trek/page_policy.rb', line 9 def create? user.privileged? end |
#destroy? ⇒ Boolean
17 18 19 |
# File 'app/policies/trek/page_policy.rb', line 17 def destroy? user.privileged? end |
#index? ⇒ Boolean
5 6 7 |
# File 'app/policies/trek/page_policy.rb', line 5 def index? user.privileged? end |
#manage? ⇒ Boolean
13 14 15 |
# File 'app/policies/trek/page_policy.rb', line 13 def manage? user.privileged? end |
#permitted_attributes ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/policies/trek/page_policy.rb', line 21 def permitted_attributes if user.privileged? [ :slug, :title, :description, :image, :content, { fragments_attributes: %i[id content] }, { versions_attributes: %i[id image content] } ] else [] end end |