Files
codeocean/app/channels/la_exercises_channel.rb
Sebastian Serth d63700c7db Add live dashboard for teachers in the context of an exercise
This commit also adds the fundamentals for ActionCable
2019-03-06 14:00:59 +01:00

17 lines
404 B
Ruby

class LaExercisesChannel < ApplicationCable::Channel
def subscribed
stream_from specific_channel
end
def unsubscribed
stop_all_streams
end
private
def specific_channel
reject unless StudyGroupPolicy.new(current_user, StudyGroup.find_by(id: params[:study_group_id])).stream_la?
"la_exercises_#{params[:exercise_id]}_channel_study_group_#{params[:study_group_id]}"
end
end