Class: RolePermit::Author
- Defined in:
- lib/permits.rb,
lib/generators/auth_assist/templates/permits.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(ability) ⇒ Author
constructor
A new instance of Author.
- #permit?(user) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(ability) ⇒ Author
Returns a new instance of Author.
77 78 79 |
# File 'lib/permits.rb', line 77 def initialize(ability) super end |
Instance Method Details
#permit?(user) ⇒ Boolean
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/permits.rb', line 81 def permit?(user) super return if !user.role? :author # can :create, Post # an author can manage posts he/she created # can :update, Post do |post| # post.try(:user) == user # end end |