I have built Ruby On Rails
application using Devise + CanCanCan + rolify Tutorial.
Here is my Ability
model:
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if user.has_role? :admin
can :manage, :all
else
can :read, :all
end
end
end
I want to allow user edit their own posts, and read posts by others.
How could I achieve that?