Commit Graph

23 Commits

Author SHA1 Message Date
David Heinemeier Hansson 5dcbe933df Added validates_each that validates each specified attribute against a block #610 [bitsweat]. Added :allow_nil as an explicit option for validates_length_of, so unless that's set to true having the attribute as nil will also return an error if a range is specified as :within #610 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@667 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-02-18 17:27:26 +00:00
David Heinemeier Hansson 0e764a5599 Addded validation for validate all the associated objects before declaring failure with validates_associated #618 [Tim Bates]. Added that validates_* now accept blocks to perform validations #618 [Tim Bates]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@650 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-02-17 19:14:15 +00:00
David Heinemeier Hansson 51390b8524 Added validates_associated that enables validation of objects in an unsaved association #398 [Tim Bates]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@418 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-01-15 17:52:08 +00:00
David Heinemeier Hansson 256d387159 Fixed quoting in validates_format_of that would allow some rules to pass regardless of input #390 [Dmitry V. Sabanin]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@288 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-31 16:42:25 +00:00
David Heinemeier Hansson ab4c640b96 Added scope option to validation_uniqueness #349 [Kent Sibilev]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@259 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-22 23:40:44 +00:00
David Heinemeier Hansson d834b65b54 Added allow_nil options to validates_inclusion_of so that validation is only triggered if the attribute is not nil [what-a-day]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@258 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-22 23:25:45 +00:00
David Heinemeier Hansson 58f2bd0cfc Fixed validates_{confirmation,acceptance}_of to only happen when the virtual attributes are not nil #348 [dpiddy@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@241 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-21 23:41:07 +00:00
David Heinemeier Hansson a2130c22d7 Set a high default salary within the validation range
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@217 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-19 11:44:59 +00:00
David Heinemeier Hansson 87b0d72fe6 Added Developer#salary for the type tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@216 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-19 11:41:34 +00:00
David Heinemeier Hansson 7b5ed66122 Added respondence to *_before_type_cast for all attributes to return their string-state before they were type casted by the column type. Added use of *_before_type_cast for all input and text fields.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-19 11:25:55 +00:00
David Heinemeier Hansson d2b75a083a Added Base.validates_inclusion_of
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@192 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-16 17:00:22 +00:00
David Heinemeier Hansson f7f1fee765 Added Base.validates_inclusion_of that validates whether the value of the specified attribute is available in a particular enumerable object. [what-a-day]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@178 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-16 03:17:43 +00:00
David Heinemeier Hansson 1579f3b45d Added Base.validates_format_of that Validates whether the value of the specified attribute is of the correct form by matching it against the regular expression provided. [Marcel]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@174 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-16 01:32:35 +00:00
David Heinemeier Hansson 846a1236bc Added Base.validates_boundries_of that delegates to add_on_boundary_breaking #312 [Tobias Luetke]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@166 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-15 12:29:08 +00:00
David Heinemeier Hansson 0bb824b715 Changed validate_* to validates_*_of, so validate_acceptance becomes validates_acceptance_of, and added :on as a configuration option instead of using _on_create/update
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-15 01:36:05 +00:00
David Heinemeier Hansson bc1aa7d9fd fixtures :models will now also attempt to include the model.rb file
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@153 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-14 18:01:28 +00:00
David Heinemeier Hansson 0c72e6d665 Options for the new validation methods are now given as a hash
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-10 16:46:41 +00:00
David Heinemeier Hansson aaf9a45ca9 Added Base.validate_uniqueness thatv alidates whether the value of the specified attributes are unique across the system. Useful for making sure that only one user can be named "davidhh".
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@108 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-10 16:02:11 +00:00
David Heinemeier Hansson 0b92b7de2f Added Base.validate_presence as an alternative to implementing validate and doing errors.add_on_empty yourself. Added _on_create and _on_update versions for all the new validations
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@107 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-10 13:11:13 +00:00
David Heinemeier Hansson 5b983f6f6b Fixed Base.errors to be indifferent as to whether strings or symbols are used.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@98 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-09 15:06:24 +00:00
David Heinemeier Hansson 27ea0b527e Added Base.validate_confirmation that encapsulates the pattern of wanting to validate the acceptance of a terms of service check box (or similar agreement)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@97 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-09 14:37:37 +00:00
David Heinemeier Hansson a65f791fbd Added Base.validate_confirmation that encapsulates the pattern of wanting to validate a password or email address field with a confirmation.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@95 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-12-09 13:37:11 +00:00
David Heinemeier Hansson db045dbbf6 Initial
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2004-11-24 01:04:44 +00:00