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
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
......
......@@ -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
......
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