Remove usage of VariablePresenter in controller

This commit is contained in:
Matija Čupić 2018-01-30 02:14:39 +01:00
parent 04263b9f3b
commit e2c8a2231b
No known key found for this signature in database
GPG Key ID: 4BAF84FFACD2E5DE
2 changed files with 4 additions and 16 deletions

View File

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

View File

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