Class: Pages::DestroyDeploymentsService
- Inherits:
-
Object
- Object
- Pages::DestroyDeploymentsService
- Defined in:
- app/services/pages/destroy_deployments_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, last_deployment_id = nil) ⇒ DestroyDeploymentsService
constructor
A new instance of DestroyDeploymentsService.
Constructor Details
#initialize(project, last_deployment_id = nil) ⇒ DestroyDeploymentsService
Returns a new instance of DestroyDeploymentsService.
5 6 7 8 |
# File 'app/services/pages/destroy_deployments_service.rb', line 5 def initialize(project, last_deployment_id = nil) @project = project @last_deployment_id = last_deployment_id end |
Instance Method Details
#execute ⇒ Object
10 11 12 13 14 |
# File 'app/services/pages/destroy_deployments_service.rb', line 10 def execute deployments_to_destroy = @project.pages_deployments deployments_to_destroy = deployments_to_destroy.older_than(@last_deployment_id) if @last_deployment_id deployments_to_destroy.find_each(&:destroy) # rubocop: disable CodeReuse/ActiveRecord end |