Support Rack 3 by renaming the name attributes of inputs #901
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On the task pages, we would create runs for a task with attributes by having inputs named
"[task_arguments][some_attribute]"
.This is because we use
fields_for
in aFormBuilder
initialized with a url, i.e.form_with(url:)
, which doesn't have anobject_name
, so when nested fields are generated, there's no object name before the first[
.Rack 3 changes the way form data is parsed, which causes all parameters to be available in
params["[task_arguments]"]
instead ofparams[:task_arguments]
.Instead of handling this, we use
fields_for
directly on the view, not on theFormBuilder
object, and we use the opportunity to renametask_arguments
totask
.Now the inputs in the task page for a run will be named
task[some_attribute]
instead of[task_arguments][some_attribute]
.I noticed in the PR upgrading Rails that the Postgres build was failing (#900). The reason is that it uses Rack 3 (since Rails 7.1 allows it), and once I ignored the Rack warnings (which will be solved in Capybara soon), I got the other failure related to the way Rack 3 parses form data.
This means that we're incompatible with Rails 7.1 and Rack 3, so I'll release a new patch version with this once merged.