Update find method

This commit is contained in:
Sebastian Serth
2022-08-20 00:17:10 +02:00
parent 6927b57170
commit c228850ae8
24 changed files with 41 additions and 41 deletions

View File

@ -58,7 +58,7 @@ class RequestForCommentsController < ApplicationController
# GET /exercises/:id/request_for_comments
def rfcs_for_exercise
exercise = Exercise.find_by(id: params[:exercise_id])
exercise = Exercise.find(params[:exercise_id])
@search = RequestForComment
.with_last_activity
.where(exercise_id: exercise.id)
@ -141,7 +141,7 @@ class RequestForCommentsController < ApplicationController
# Use callbacks to share common setup or constraints between actions.
def set_request_for_comment
@request_for_comment = RequestForComment.find_by(id: params[:id])
@request_for_comment = RequestForComment.find(params[:id])
end
def request_for_comment_params
@ -154,7 +154,7 @@ class RequestForCommentsController < ApplicationController
# The index page requires the grouping of the study groups
# The study groups are grouped by the current study group and other study groups of the user
def set_study_group_grouping
current_study_group = StudyGroup.find_by(id: session[:study_group_id])
current_study_group = StudyGroup.find_by(session[:study_group_id])
my_study_groups = current_user.study_groups.reject {|group| group == current_study_group }
@study_groups_grouping = [[t('request_for_comments.index.study_groups.current'), Array(current_study_group)],
[t('request_for_comments.index.study_groups.my'), my_study_groups]]