Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor refactoring of validates_associated to replace #inject with #co…
…llect + #all? [#1686 state:committed]
- Loading branch information
ccda960
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.
ccda960
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.
Wow, the comment is not as seriously meant as github formats it…
ccda960
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.
GitHub comments needs a preview button for sure…
ccda960
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.
ccda960
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.
The semantics of this method are very specific and won’t work with the all? block. The enumeration must call #valid? on every value to force generation of all errors, then the #all? will return whether the whole set if valid.
ccda960
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.
ha, didn’t realize i was logged in as pivotal when i typed that previous comment. but i stand by it!
ccda960
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.
[*value] would be an improvement over (value.is_a?(Array) ? value : [value]), though, both in readability and performance.
ccda960
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.
Ummm…half my comment disappeared? I was trying to say:
would be an improvement over