Class: RolePermit::Author

Inherits:
Base
  • Object
show all
Defined in:
lib/permits.rb,
lib/generators/auth_assist/templates/permits.rb

Instance Attribute Summary

Attributes inherited from Base

#ability

Instance Method Summary collapse

Methods inherited from Base

#can, #cannot, #owns

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

Returns:

  • (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