cleanup duplicate code
This commit is contained in:
@ -1,8 +1,7 @@
|
|||||||
class UserExerciseFeedbacksController < ApplicationController
|
class UserExerciseFeedbacksController < ApplicationController
|
||||||
include CommonBehavior
|
include CommonBehavior
|
||||||
|
|
||||||
before_action :set_user_exercise_feedback, only: [:edit, :update]
|
before_action :set_user_exercise_feedback, only: [:edit, :update, :show, :destroy]
|
||||||
before_action :set_user_exercise_feedback_by_id, only: [:show, :destroy]
|
|
||||||
|
|
||||||
def comment_presets
|
def comment_presets
|
||||||
[[0,t('user_exercise_feedback.difficulty_easy')],
|
[[0,t('user_exercise_feedback.difficulty_easy')],
|
||||||
@ -107,10 +106,6 @@ class UserExerciseFeedbacksController < ApplicationController
|
|||||||
@exercise = @uef.exercise
|
@exercise = @uef.exercise
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_user_exercise_feedback_by_id
|
|
||||||
@uef = UserExerciseFeedback.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def uef_params
|
def uef_params
|
||||||
params[:user_exercise_feedback].permit(:feedback_text, :difficulty, :exercise_id, :user_estimated_worktime).merge(user_id: current_user.id, user_type: current_user.class.name) if params[:user_exercise_feedback].present?
|
params[:user_exercise_feedback].permit(:feedback_text, :difficulty, :exercise_id, :user_estimated_worktime).merge(user_id: current_user.id, user_type: current_user.class.name) if params[:user_exercise_feedback].present?
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user