diff options
Diffstat (limited to 'app/controllers/projects/milestones_controller.rb')
-rw-r--r-- | app/controllers/projects/milestones_controller.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index 569a514b23b..35b65dbce7e 100644 --- a/app/controllers/projects/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -76,7 +76,6 @@ class Projects::MilestonesController < Projects::ApplicationController @milestone = Milestones::UpdateService.new(project, current_user, milestone_params).execute(milestone) respond_to do |format| - format.js format.html do if @milestone.valid? redirect_to project_milestone_path(@project, @milestone) @@ -84,6 +83,16 @@ class Projects::MilestonesController < Projects::ApplicationController render :edit end end + + format.js + + 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| |