Remove usage of VariablePresenter in controller
This commit is contained in:
parent
04263b9f3b
commit
e2c8a2231b
2 changed files with 4 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue