(sorry for my English 😉
I started to use CanCan from rbates, this is awesome gem, but I have some problems:
I have Scrap model and there is boolean field :published (so, it means published/not published (draft)).
I have this rule in my ability.rb:
can :create, [Scrap]
can [:update, :destroy], [Scrap] do |object|
object.try(:user) == user
end
So, this object cant be edited/updated/deleted by non-author. I want to do the same with my “show” action (non-author cant read drafts, really? 😉 What is the true way to do this?
Thanx all!
Andrey Ognevsky
1 Answer