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

Remove usage of VariablePresenter in controller

parent 04263b9f
......@@ -5,10 +5,7 @@ module Groups
def show
respond_to do |format|
format.json do
variables = @group.variables
.map { |variable| variable.present(current_user: current_user) }
render status: :ok, json: { variables: GroupVariableSerializer.new.represent(variables) }
render status: :ok, json: { variables: GroupVariableSerializer.new.represent(@group.variables) }
end
end
end
......@@ -17,10 +14,7 @@ module Groups
respond_to do |format|
format.json do
if @group.update(variables_params)
variables = @group.variables
.map { |variable| variable.present(current_user: current_user) }
return render status: :ok, json: { variables: GroupVariableSerializer.new.represent(variables) }
return render status: :ok, json: { variables: GroupVariableSerializer.new.represent(@group.variables) }
end
render status: :bad_request, json: @group.errors.full_messages
......
......@@ -4,10 +4,7 @@ class Projects::VariablesController < Projects::ApplicationController
def show
respond_to do |format|
format.json do
variables = @project.variables
.map { |variable| variable.present(current_user: current_user) }
render status: :ok, json: { variables: VariableSerializer.new.represent(variables) }
render status: :ok, json: { variables: VariableSerializer.new.represent(@project.variables) }
end
end
end
......@@ -16,10 +13,7 @@ class Projects::VariablesController < Projects::ApplicationController
respond_to do |format|
format.json do
if @project.update(variables_params)
variables = @project.variables
.map { |variable| variable.present(current_user: current_user) }
return render status: :ok, json: { variables: VariableSerializer.new.represent(variables) }
return render status: :ok, json: { variables: VariableSerializer.new.represent(@project.variables) }
end
render status: :bad_request, json: @project.errors.full_messages
......
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