class RequestForCommentPolicy < ApplicationPolicy def author? @user == @record.author end private :author? def create? everyone end def show? everyone end [:destroy?].each do |action| define_method(action) { admin? } end def mark_as_solved? admin? || author? end def edit? admin? end def index? everyone end end