diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb index 3e78711dabf5df2624c4d29f2a7d36411021eee0..0ebfebd6682a465f9faee977c6d53247e5655128 100644 --- a/app/controllers/groups/variables_controller.rb +++ b/app/controllers/groups/variables_controller.rb @@ -11,13 +11,13 @@ module Groups end def update - respond_to do |format| - format.json do - if @group.update(variables_params) - return render status: :ok, json: { variables: GroupVariableSerializer.new.represent(@group.variables) } - end - - render status: :bad_request, json: @group.errors.full_messages + if @group.update(variables_params) + respond_to do |format| + format.json { return render status: :ok, json: { variables: GroupVariableSerializer.new.represent(@group.variables) } } + end + else + respond_to do |format| + format.json { render status: :bad_request, json: @group.errors.full_messages } end end end diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb index 18225218a1b1886ce6f3a9226ba3d2b70fe246b2..329e1cdfef088f99fb4c1be6c2f67117d9f772c4 100644 --- a/app/controllers/projects/variables_controller.rb +++ b/app/controllers/projects/variables_controller.rb @@ -10,13 +10,13 @@ class Projects::VariablesController < Projects::ApplicationController end def update - respond_to do |format| - format.json do - if @project.update(variables_params) - return render status: :ok, json: { variables: VariableSerializer.new.represent(@project.variables) } - end - - render status: :bad_request, json: @project.errors.full_messages + if @project.update(variables_params) + respond_to do |format| + format.json { return render status: :ok, json: { variables: VariableSerializer.new.represent(@project.variables) } } + end + else + respond_to do |format| + format.json { render status: :bad_request, json: @project.errors.full_messages } end end end