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

Switch emphasis from controller format to update

parent 601fba38
......@@ -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
......
......@@ -12,13 +12,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
......
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