diff options
Diffstat (limited to 'app/controllers/groups/milestones_controller.rb')
-rw-r--r-- | app/controllers/groups/milestones_controller.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb index 903c8c214ae..5f6b55ea928 100644 --- a/app/controllers/groups/milestones_controller.rb +++ b/app/controllers/groups/milestones_controller.rb @@ -44,7 +44,19 @@ class Groups::MilestonesController < Groups::ApplicationController def update Milestones::UpdateService.new(@milestone.parent, current_user, milestone_params).execute(@milestone) - redirect_to milestone_path(@milestone) + respond_to do |format| + format.html do + redirect_to milestone_path(@milestone) + end + + format.json do + if @milestone.valid? + head :no_content + else + render json: { errors: @milestone.errors.full_messages }, status: :unprocessable_entity + end + end + end rescue ActiveRecord::StaleObjectError respond_to do |format| format.html do |