aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fixed that Base.save should always return false if the save didn't succeed, ↵David Heinemeier Hansson2006-02-281-3/+5
| | | | | | including if it has halted by before_save's (closes #1861, #2477) [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3707 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Example for validates_presence_of method (closes #3966) [Robby Russell]David Heinemeier Hansson2006-02-261-1/+7
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3677 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed validates_length_of to work on UTF-8 strings by using characters ↵David Heinemeier Hansson2006-02-251-21/+25
| | | | | | instead of bytes (closes #3699) [Masao Mutoh] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Renamed Errors#count to Errors#size but kept an alias for the old name (and ↵David Heinemeier Hansson2006-02-231-1/+4
| | | | | | included an alias for length too) (closes #3920, #3320) [contact@lukeredpath.co.uk] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3639 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* ActiveRecord::RecordInvalid now states which validations failed in its ↵Tobias Lütke2006-02-051-2/+2
| | | | | | default error message git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3544 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Silly meDavid Heinemeier Hansson2006-02-011-5/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3513 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Errors#any? to mean !Errors#empty? [DHH]David Heinemeier Hansson2006-02-011-0/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3510 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Disambiguate table names for columns in validates_uniquness_of's WHERE ↵Marcel Molina2006-01-131-3/+3
| | | | | | clause. Closes #3423. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3402 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow validate_uniqueness_of to be scoped by more than just one column. ↵Marcel Molina2005-12-021-5/+15
| | | | | | Closes #1559. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3206 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Revert [3130]. Behavior of introducing Kernel.binding causes breakage.Marcel Molina2005-11-211-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3142 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Use Kernel.binding rather than binding to allow columns of that name. ↵Jeremy Kemper2005-11-211-2/+2
| | | | | | References #2973. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3139 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r3095@asus: jeremy | 2005-11-15 22:40:51 -0800Jeremy Kemper2005-11-161-6/+13
| | | | | | | | | | | | | | | | | | | | | | | Ticket #1874 - Firebird adapter r3107@asus: jeremy | 2005-11-16 00:06:14 -0800 quote column aliases r3108@asus: jeremy | 2005-11-16 00:08:12 -0800 quote columns in construct_conditions_from_arguments. update sequence_name docs. introduce prefetched primary keys. r3109@asus: jeremy | 2005-11-16 00:09:08 -0800 double-quote rather than single-quote sqlite columns r3110@asus: jeremy | 2005-11-16 00:09:56 -0800 quote column names and use attribute_condition in validates_uniqueness_of r3111@asus: jeremy | 2005-11-16 00:12:24 -0800 Use QUOTED_TYPE constant in tests r3112@asus: jeremy | 2005-11-16 00:13:28 -0800 restrict test_inserts_with_pre_and_suffix to those adapters which support migrations r3113@asus: jeremy | 2005-11-16 00:14:09 -0800 Use QUOTED_TYPE constant in tests r3114@asus: jeremy | 2005-11-16 00:14:30 -0800 Use QUOTED_TYPE constant in tests git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3051 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make Validations#create! use the current scopeJamis Buck2005-11-121-0/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2984 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Include the Enumerable module in ActiveRecord::Errors.Jeremy Kemper2005-11-111-0/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2981 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow capital letters in the email address in the the validates_format_of ↵Florian Weber2005-11-091-1/+1
| | | | | | example git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2950 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add Model.create! to match existing model.save! method. When save! raises ↵Jeremy Kemper2005-11-031-35/+65
| | | | | | RecordInvalid, you can catch the exception, retrieve the invalid record (invalid_exception.record), and see its errors (invalid_exception.record.errors). git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2863 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix docs (closes #2491)David Heinemeier Hansson2005-10-261-5/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2744 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Minor documentation fixFlorian Weber2005-10-251-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2726 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Association validation does not belong in a before_save callback: move it ↵Jeremy Kemper2005-10-021-3/+7
| | | | | | into a validation method. Restores the expected model.valid? == model.save. Add tests for cancelling save by returning false from a before_save callback. Remove assumption that before_destroy's return value indicates whether the record was destroyed. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2434 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r3604@asus: jeremy | 2005-09-26 19:10:42 -0700Jeremy Kemper2005-09-261-20/+29
| | | | | | | Treat validates_size_of :within as a single validator rather than splitting it into to ends of the range, thus yield two error messages on nil (yuck) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2355 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make update_attribute use the same writer method that update_attributes uses.Marcel Molina2005-09-261-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2353 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactored to a more readble form #1813David Heinemeier Hansson2005-09-111-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2202 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix typo in validations documentation #1938 [court3nay]Jamis Buck2005-08-141-1/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2010 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed validates_numericality_of to work with overrided getter-method when ↵David Heinemeier Hansson2005-07-021-0/+1
| | | | | | :allow_nil is on #1316 [raidel@onemail.at] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1603 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Clarified intentions of validates_associated #870David Heinemeier Hansson2005-07-021-1/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1602 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Updated all references to the old find_first and find_all to use the new ↵David Heinemeier Hansson2005-06-261-2/+2
| | | | | | style #1511 [Marcel Molina] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1520 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that validations didn't respecting custom setting for too_short, ↵David Heinemeier Hansson2005-06-251-7/+3
| | | | | | too_long messages #1437 [Marcel Molina] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added ActiveRecord::Recursion to guard against recursive calls to #saveJamis Buck2005-06-131-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1411 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Errors#add_on_blank which works like Errors#add_on_empty, but uses ↵David Heinemeier Hansson2005-05-211-6/+15
| | | | | | Object#blank? instead. CHANGED: validates_presence_of now uses Errors#add_on_blank, which will make " " fail the validation where it didnt before #1309. Added that " " is now also blank? (using strip if available) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1346 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added the :if option to all validations that can either use a block or a ↵David Heinemeier Hansson2005-05-211-5/+66
| | | | | | method pointer to determine whether the validation should be run or not. #1324 [Duane Johnson/jhosteny] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1340 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed docs for scaffolding generator #1303 [thijs@vandervossen.net]David Heinemeier Hansson2005-05-191-2/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1312 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that validate_length_of lost :on option when :within was specified ↵David Heinemeier Hansson2005-04-301-3/+5
| | | | | | #1195 [jhosteny@mac.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1258 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added validates_exclusion_of as a negative of validates_inclusion_ofDavid Heinemeier Hansson2005-04-241-0/+25
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1236 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed documentation and prepared for release of 0.12David Heinemeier Hansson2005-04-181-3/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1216 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base.save! that attempts to save the record just like Base.save but ↵David Heinemeier Hansson2005-04-181-0/+9
| | | | | | will raise a InvalidRecord exception instead of returning false if the record is not valid [After much pestering from Dave Thomas] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added the option to specify the acceptance string in validates_acceptance_of ↵David Heinemeier Hansson2005-04-171-3/+5
| | | | | | #1106 [caleb@aei-tech.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1188 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Cleaned up validates_length_of by calling existing validations on the common ↵David Heinemeier Hansson2005-04-171-29/+17
| | | | | | stuff #1108 [caleb@aei-tech.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1178 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Address parsing failed when the "to" (or "cc", or whatever) was an array. It ↵David Heinemeier Hansson2005-04-131-4/+4
| | | | | | was also too restrictive in the formats of the addresses #1097 [Jamis] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1149 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added optionally allow for nil or empty strings with ↵David Heinemeier Hansson2005-03-141-56/+46
| | | | | | validates_numericality_of #801 [Sebastian Kanthak] Fixed problem with using slashes in validates_format_of regular expressions #801 [Sebastian Kanthak] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@910 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added validates_numericality_of #716 [skanthak/c.r.mcgrath]David Heinemeier Hansson2005-03-061-42/+76
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@842 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Finished polishing API docsDavid Heinemeier Hansson2005-02-231-1/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@773 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that when using validation macros with a custom message, if you ↵David Heinemeier Hansson2005-02-221-3/+11
| | | | | | happened to use single quotes in the message string you would get a parsing error #657 [tonka] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@740 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added validates_each that validates each specified attribute against a block ↵David Heinemeier Hansson2005-02-181-181/+254
| | | | | | #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
* Addded validation for validate all the associated objects before declaring ↵David Heinemeier Hansson2005-02-171-3/+3
| | | | | | 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
* Fixed documentation snafus #575, #576, #577, #585David Heinemeier Hansson2005-02-071-3/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@525 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed documentation #538David Heinemeier Hansson2005-01-251-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@503 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Replaced === checks with is_a? checks #502, #82 [Marcel Molina]David Heinemeier Hansson2005-01-201-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@466 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added validates_associated that enables validation of objects in an unsaved ↵David Heinemeier Hansson2005-01-151-0/+33
| | | | | | association #398 [Tim Bates] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@418 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed Base#update_attribute to be indifferent to whether a string or symbol ↵David Heinemeier Hansson2005-01-061-1/+1
| | | | | | is used to describe the name git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@341 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed #406 for realDavid Heinemeier Hansson2005-01-041-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@329 5ecf4fe2-1ee6-0310-87b1-e25e094e27de