Commit e057ad97 authored by Pawel Chojnacki's avatar Pawel Chojnacki

DeploymentsSerializer can serialize arrays properly

parent e1e0b763
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
......
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