fixed broken exercise cloning
This commit is contained in:
@ -16,12 +16,13 @@ class ExercisesController < ApplicationController
|
|||||||
private :authorize!
|
private :authorize!
|
||||||
|
|
||||||
def clone
|
def clone
|
||||||
exercise = @exercise.duplicate(public: false, user: current_user)
|
exercise = @exercise.duplicate(public: false, token: nil, user: current_user)
|
||||||
|
exercise.send(:generate_token)
|
||||||
if exercise.save
|
if exercise.save
|
||||||
redirect_to(exercise, notice: t('shared.object_cloned', model: Exercise.model_name.human))
|
redirect_to(exercise, notice: t('shared.object_cloned', model: Exercise.model_name.human))
|
||||||
else
|
else
|
||||||
flash[:danger] = t('shared.message_failure')
|
flash[:danger] = t('shared.message_failure')
|
||||||
redirect_to(exercises_path)
|
redirect_to(@exercise)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user