DeploymentsSerializer can serialize arrays properly
This commit is contained in:
parent
e1e0b763dc
commit
e057ad975c
1 changed files with 3 additions and 4 deletions
|
@ -1,14 +1,13 @@
|
|||
class Projects::DeploymentsController < Projects::ApplicationController
|
||||
before_action :authorize_read_environment!
|
||||
before_action :authorize_read_deployment!
|
||||
|
||||
def index
|
||||
serializer = DeploymentSerializer.new(user: @current_user, project: project)
|
||||
|
||||
deployments = environment.deployments.reorder(created_at: :desc)
|
||||
deployments = deployments.where('created_at > ?', params[:after].to_time) if params[:after]&.to_time
|
||||
deployments = deployments.map { |deployment| serializer.represent(deployment) }
|
||||
|
||||
render json: { deployments: deployments }
|
||||
render json: { deployments: DeploymentSerializer.new(user: @current_user, project: project)
|
||||
.represent(deployments) }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue