Class: Hyrax::Transactions::Steps::RemoveRedirectPaths
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::RemoveRedirectPaths
- Defined in:
- lib/hyrax/transactions/steps/remove_redirect_paths.rb
Overview
A dry-transaction step that removes a resource's rows from the
hyrax_redirect_paths redirects table. Runs as part of the destroy
transactions so deleted resources don't leave dangling claims on
redirect paths.
See documentation/redirects.md.
Instance Method Summary collapse
Instance Method Details
#call(resource) ⇒ Dry::Monads::Result
18 19 20 21 22 23 24 25 |
# File 'lib/hyrax/transactions/steps/remove_redirect_paths.rb', line 18 def call(resource) return Success(resource) unless removable?(resource) Hyrax::RedirectPath.where(resource_id: resource.id.to_s).delete_all Success(resource) rescue ActiveRecord::StatementInvalid => e Hyrax.logger.error("[redirects] remove_redirect_paths failed: #{e.}") Failure([:redirect_path_remove_error, e.]) end |