diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 327d8636fe..25659617a9 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -175,7 +175,9 @@ def set_submissions end @series = Series.find(params[:series_id]) if params[:series_id] - @activity = Exercise.find(params[:activity_id]) if params[:activity_id] + # both /activities/:id/submissions and /exercises/:id/submissions are valid routes + activity_id = params[:activity_id] || params[:exercise_id] + @activity = Exercise.find(activity_id) if activity_id @judge = Judge.find(params[:judge_id]) if params[:judge_id] if @activity diff --git a/test/controllers/submissions_controller_test.rb b/test/controllers/submissions_controller_test.rb index ea827d37f9..6628816e6c 100644 --- a/test/controllers/submissions_controller_test.rb +++ b/test/controllers/submissions_controller_test.rb @@ -460,4 +460,11 @@ def expected_score_string(*args) assert_response :ok end + + test 'should be able to use legacy paths containing `exercise`' do + course = create :course, series_count: 1, activities_per_series: 1 + get course_series_exercise_submissions_path(course, course.series.first, course.series.first.exercises.first) + + assert_response :ok + end end