-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
[ci skip] add class level documentation to ActiveModel::Type::Boolean #25575
[ci skip] add class level documentation to ActiveModel::Type::Boolean #25575
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @eileencodes (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
r? @sgrif |
# Values set from user or database input will first be coerced into a | ||
# appropriate ruby type. | ||
# | ||
# - Values specified in +FALSE_VALUES+ will be coerced to +false+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mention the most common ones explicitly, false, "0", 0, and 'f'
.
8b043c1
to
11cc30c
Compare
@sgrif @rafaelfranca all feedback addressed |
# appropriate ruby type. | ||
# | ||
# - Values specified in +FALSE_VALUES+ will be coerced to +false+. | ||
# - e.g. "false", "f" , "0", and +0+ will all be coerced to +false+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer this to be a bit more human. Something like:
false
, "f"
, "0"
, 0
, or any other value in FALSE_VALUES
will be coerced to false
TIL I have more opinions than I realized about how to document type coercion to booleans. |
Thanks for working on this @taboularasa ❤️ |
@sgrif thanks for your feedback and please keep it coming, I would like to get a good sense for this before I work on documenting the rest of the |
11cc30c
to
5702045
Compare
@sgrif ok all feedback addressed again, please take another look when you get a chance |
I'm about to head to bed, and I'm in Europe for a few weeks as of tomorrow, but I will try to take a look soon (but it won't be until Saturday at the earliest) |
Np, take your time |
# | ||
# === Coercion | ||
# Values set from user input will first be coerced into the appropriate ruby type. | ||
# Coercion behaivor is roughly mapped to Ruby's boolean semantics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/behaivor/behavior
LGTM other than the typo. |
add documentation of the behaviors of type coercion at the class level
5702045
to
3691c75
Compare
typo fixed and rebased |
Summary
adds documentation of the behaviors of type coercion at the class level to ActiveModel::Type::Boolean
Other Information
@sgrif per our conversation last week, let me know if this is what you had in mind.