Commit c95c3ffc authored by Matija Čupić's avatar Matija Čupić

Switch emphasis from controller format to update

parent e2c8a223
...@@ -11,13 +11,13 @@ module Groups ...@@ -11,13 +11,13 @@ module Groups
end end
def update def update
respond_to do |format| if @group.update(variables_params)
format.json do respond_to do |format|
if @group.update(variables_params) format.json { return render status: :ok, json: { variables: GroupVariableSerializer.new.represent(@group.variables) } }
return render status: :ok, json: { variables: GroupVariableSerializer.new.represent(@group.variables) } end
end else
respond_to do |format|
render status: :bad_request, json: @group.errors.full_messages format.json { render status: :bad_request, json: @group.errors.full_messages }
end end
end end
end end
......
...@@ -10,13 +10,13 @@ class Projects::VariablesController < Projects::ApplicationController ...@@ -10,13 +10,13 @@ class Projects::VariablesController < Projects::ApplicationController
end end
def update def update
respond_to do |format| if @project.update(variables_params)
format.json do respond_to do |format|
if @project.update(variables_params) format.json { return render status: :ok, json: { variables: VariableSerializer.new.represent(@project.variables) } }
return render status: :ok, json: { variables: VariableSerializer.new.represent(@project.variables) } end
end else
respond_to do |format|
render status: :bad_request, json: @project.errors.full_messages format.json { render status: :bad_request, json: @project.errors.full_messages }
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment