Allow form and button attributes in helper methods#111
Merged
RenzoMinelli merged 9 commits intomasterfrom Mar 3, 2026
Merged
Conversation
3666c41 to
89bca3a
Compare
Comment on lines
+6
to
+10
| def passkey_creation_form_for(resource_or_resource_name, html_options: {}, &block) | ||
| form_with( | ||
| url: passkeys_path(resource_or_resource_name), | ||
| method: :post, | ||
| class: form_classes | ||
| **html_options |
Collaborator
There was a problem hiding this comment.
I think we could just do:
def passkey_creation_form_for(resource_or_resource_name, **options, &block)
form_with(
**options.merge(url: passkeys_path(resource_or_resource_name), method: :post)
) do |f|which would allow users of this gem to use or helpers pretty much like Rails' form helpers:
passkey_creation_form_for(:user, class: "my-form", data: { turbo: false })What do you think?
Contributor
Author
There was a problem hiding this comment.
interesting idea, yeah that sounds good.
4e44a76 to
d621332
Compare
santiagorodriguez96
approved these changes
Mar 3, 2026
|
|
||
| - Options for getting or creating passkeys and security keys are now served by dedicated Rails controllers and retrieved via JavaScript fetch requests. [#73](https://github.com/cedarcode/devise-webauthn/pull/73) [@nicolastemciuc] | ||
| - BREAKING!: Remove helpers for generating WebAuthn options. [#106](https://github.com/cedarcode/devise-webauthn/pull/115) [@nicolastemciuc] | ||
| - BREAKING: Replace `form_classes:` keyword argument with direct keyword arguments in all form helper methods (`passkey_creation_form_for`, `login_with_passkey_form_for`, `security_key_creation_form_for`, `login_with_security_key_form_for`). All options are delegated to `form_with`, allowing you to pass any HTML attributes or form options directly. [@RenzoMinelli] |
Collaborator
There was a problem hiding this comment.
nit: we are using BREAKING!: (with a bang !) instead of BREAKING 🙂
Just for sake of consistency
d621332 to
18c55ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
Allow form and button attributes in helper methods
Why?
Currently there's no easy way to set data attributes on these forms/buttons. So in this PR I propose we change these helper methods to accept a hash of attributes and simply delegate them to view helpers