Skip to content

Comments

Change form_with extension's default :model option#34

Open
seanpdoyle wants to merge 1 commit intoamatsuda:masterfrom
seanpdoyle:rails-8-1-nil-model
Open

Change form_with extension's default :model option#34
seanpdoyle wants to merge 1 commit intoamatsuda:masterfrom
seanpdoyle:rails-8-1-nil-model

Conversation

@seanpdoyle
Copy link

@seanpdoyle seanpdoyle commented Jan 13, 2026

Closes #32

As of rails@~>7.2.0, the form_with method rejects :model options that are nil. To achieve compatibility with the new support, this commit modifies the form builder extension to change the default :model keyword argument to model: false rather than model: nil.

To exercise that behavior, this commit introduces the FormsController to the test suite, along with #new and #create routes.

As of `rails@~>7.2.0`, the `form_with` method [rejects][] `:model`
options that are `nil`. To achieve compatibility with the new support,
this commit modifies the form builder extension to change the default
`:model` keyword argument to `model: false` rather than `model: nil`.

To exercise that behavior, this commit introduces the `FormsController`
to the test suite, along with `#new` and `#create` routes.

[rejects]: rails/rails@12b093d
@seanpdoyle
Copy link
Author

@amatsuda
Are you able to enable the execution of CI?

I'd opened this PR without knowledge of #33. The changes in this diff aim to resolve the same issue, but with fewer changes. For example, it does not modify the CI matrix, and does not duplicate the form_with extension depending on the Rails version. It aims for compliance with a single change: model: nil to model: false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supporting form_with in Rails 8.0

1 participant