The pipeline admin form could never save
`ActiveAdmin.register WarpEngine::Pipeline` declared no `permit_params`, so every edit handed unpermitted attributes to the model and Rails raised ForbiddenAttributesError. That is not new: the form has been unable to save for as long as it has existed. My flash message on `update` sat at the top of the traceback and made it look like the cause, which it was not — and it is gone anyway, because overriding an ActiveAdmin action to say something is a poor trade for what it can break. The move is written to the log instead. Adding a spec that would have caught it, in the host app, because that is where the ActiveAdmin instance lives: it signs in, PUTs the form, and checks both that the record saves and that the software link moves off the pipeline that had it. Driven the same way by hand against the development database first — 302, the link moved, the previous holder left without one. The engine's other admin resources were checked for the same omission: downloads and releases are read-only and the file manager posts to its own routes, so pipelines was the only one affected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -55,6 +55,16 @@ module WarpEngine
|
||||
|
||||
others = Pipeline.where(software_id: software_id).where.not(id: id)
|
||||
@software_taken_from = others.map(&:full_name)
|
||||
return if @software_taken_from.empty?
|
||||
|
||||
# Logged rather than flashed. The first attempt at this put a message on screen by
|
||||
# overriding the admin's `update` action, which bypassed the permitted-params path
|
||||
# and made every pipeline edit fail with ForbiddenAttributesError. A silent
|
||||
# reassignment is a small problem; an admin page that cannot save is a large one.
|
||||
Rails.logger.info(
|
||||
"[WarpEngine::Pipeline] #{full_name} took software #{software_id} from " \
|
||||
"#{@software_taken_from.join(', ')}"
|
||||
)
|
||||
others.update_all(software_id: nil, updated_at: Time.current)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user