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

Add example of conditionally requiring a password [ci-skip] #45754

Conversation

jonathanhefner
Copy link
Member

This example addresses the use case brought up by #45487, which has been reverted by #45753.


/cc @liljack

This example addresses the use case brought up by rails#45487, which has been
reverted by rails#45753.
@rails-bot rails-bot bot added the activemodel label Aug 3, 2022
@jonathanhefner jonathanhefner merged commit 3f81469 into rails:main Aug 3, 2022
#
# def errors
# errors = super
# errors.delete(:password, :blank) if is_guest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd inline the exception with a tap, so: super.tap { |errors| errors.delete(:password, :blank) if is_guest }

jonathanhefner added a commit to jonathanhefner/rails that referenced this pull request Aug 9, 2022
…d-conditional-password-example

Add example of conditionally requiring a password [ci-skip]

(cherry picked from commit 3f81469)
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