Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validates_format_of :without => /regexp/ option [Elliot Winkler, …
…Peer Allan] [#430 state:resolved] Example : validates_format_of :subdomain, :without => /www|admin|mail/ Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
- Loading branch information
Showing
3 changed files
with
64 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,5 +1,11 @@ | |||
*Edge* | *Edge* | ||
|
|
||
* Add validates_format_of :without => /regexp/ option. #430 [Elliot Winkler, Peer Allan] | |||
|
|||
Example : | |||
|
|||
validates_format_of :subdomain, :without => /www|admin|mail/ | |||
|
|||
* Introduce validates_with to encapsulate attribute validations in a class. #2630 [Jeff Dean] | * Introduce validates_with to encapsulate attribute validations in a class. #2630 [Jeff Dean] | ||
|
|
||
* Extracted from Active Record and Active Resource. | * Extracted from Active Record and Active Resource. |
This file contains 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
This file contains 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
cccb0e6
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 docs should mention that :with or :without cannot both be specified. (The ArgumentError in the code does a good job of this.) Also, the doc line "both must be a regular expression" is very confusing. It should probably be rewritten to something like:
You must pass either :with or :without as an option, but not both.
The argument to :with or :without must be a regular expression.
There's no real need to explicitly state that an exception will be raised, since "must" already implies that.