Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate [id] for FormBuilder#button called with method name #43886

Merged

Conversation

seanpdoyle
Copy link
Contributor

Follow-up to rails/rails#43411 (merged in 15f6113)

Summary

By default, when generating a <button> element through a Form Builder
instance, the element's [name] attribute is populated by calling the
FormBuilder#field_name method. This commit assigns a matching default
[id] attribute generated by FormBuilder#field_id.

Additionally, it adds test coverage to ensure that calls that provide
their own name: and id: options are not overridden by the default
values.

Follow-up to [rails#43411][] (merged in [15f6113][])

By default, when generating a `<button>` element through a Form Builder
instance, the element's `[name]` attribute is populated by calling the
`FormBuilder#field_name` method. This commit assigns a matching default
`[id]` attribute generated by `FormBuilder#field_id`.

Additionally, it adds test coverage to ensure that calls that provide
their own `name:` and `id:` options are not overridden by the default
values.

[rails#43411]: rails#43411
[15f6113]: rails@15f6113
@rails-bot rails-bot bot added the actionview label Dec 15, 2021
@seanpdoyle
Copy link
Contributor Author

@rafaelfranca this might be a good follow-up to (for #43411) consider for an RC. I'm sorry to have missed this the first time around.

@rafaelfranca rafaelfranca merged commit 2a55e34 into rails:main Dec 15, 2021
rafaelfranca added a commit that referenced this pull request Dec 15, 2021
…name-id

Generate `[id]` for `FormBuilder#button` called with method name
@seanpdoyle seanpdoyle deleted the form-builder-button-method-name-id branch December 15, 2021 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants