klaay-chatbot/app/models/ability.rb

13 lines
292 B
Ruby

# frozen_string_literal: true
class Ability
include CanCan::Ability
def initialize(user)
can :create, Conversation
can :read, Conversation, user: user
can :create, Message, conversation: { user: user }
can %i[index read], Message, conversation: { user: user }
end
end