Switch emphasis from controller format to update

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册