I have table user and topic in my application. User who create topic has full ability of it and this user can grant ability to other user to access or edit. How can I implement this struct in cancan. I want something like
can? :edit, @topic
can :edit, Topic do |topic|
//get object @topic i pass above, and check current user has ability to edit this topic
end
I think about create new table name topic_share with topic_id and user_id. Many-many relation between topic and user. I don't know how to implement it in cancan.