aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations
Commit message (Collapse)AuthorAgeFilesLines
* Follow up to bbe7fe41 to fix enum leakage across classes.Godfrey Chan2014-04-071-1/+1
| | | | | | | | The original attempt didn't really fix the problem and wasn't testing the problematic area. This commit corrected those issues in the original commit. Also removed the private `enum_mapping_for` method. As `defined_enums` is now a method, this method doesn't provide much value anymore.
* Merge pull request #13040 from kamipo/case_sensitive_comparisonRafael Mendonça França2014-03-121-2/+1
|\ | | | | | | | | | | | | Only use BINARY for mysql case sensitive uniqueness check when column has a case insensitive collation. Conflicts: activerecord/CHANGELOG.md
| * Only use BINARY for mysql case sensitive uniqueness check when column has a ↵Ryuta Kamizono2013-11-261-2/+1
| | | | | | | | case insensitive collation.
* | WhitespacesRafael Mendonça França2014-03-101-2/+2
| |
* | Fix a bug affecting validations of enum attributesTheMonster2014-02-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug where any enum attribute of a model would be evaluated always as 0 when calling the database on validations. This fix converts the value of the enum attribute to its integer value rather than the string before building the relation as the bug occured when the string finally gets converted to integer using string.to_i which converts it to 0. [Vilius Luneckas, Ahmed AbouElhamayed]
* | Use `Array#wrap` instead `Array()`gmarik2013-12-311-1/+1
| | | | | | | | - since `Array()` calls `to_ary` or `to_a` on a subject - the intent is to 'wrap' subject into an array
* | Cleanups in API docs: his => theirGuillermo Iguaran2013-12-021-2/+2
| |
* | Use genderless pronouns in API docsGuillermo Iguaran2013-12-011-1/+1
| |
* | Merge pull request #13061 from ↵Rafael Mendonça França2013-11-261-1/+9
|/ | | | | | | | laurocaetano/fix-uniqueness-validation-for-aliased-attribute Fix bug when validating the uniqueness of an aliased attribute. Conflicts: activerecord/CHANGELOG.md
* Fix validation on uniqueness of empty associationEvgeny Li2013-11-221-1/+1
|
* replace artificial space with RDoc markup (follow up #11285). [ci skip]Yves Senn2013-07-041-2/+2
|
* [ci skip] Separated full stop from the Optimistic_concurrency_control wiki ↵ankit88982013-07-041-1/+1
| | | | link d4e3f8ba826cd42aa3c242149
* Revert "Merge pull request #4490 from EmmanuelOga/master"José Valim2013-06-041-1/+1
| | | | | | | | This behaviour doesn't actually make sense, the context of the child should not be affected by the parent. See #10492. This reverts commit 5f8274efe128ffeec8fa3179460f5167a078f007, reversing changes made to 81e837e810460d066a2e5fc5a795366ec8ab2313.
* deprecate Validator#setup (to get rid of a respond_to call). validators do ↵Nick Sutterer2013-05-231-6/+1
| | | | their setup in their constructor now.
* documentation fixes for Array.wrap and AR::Validations::AssociatedValidatorHrvoje Šimić2013-04-171-2/+2
|
* Change uniq validation with conditions examples to use where with hashesCarlos Antonio da Silva2013-03-091-3/+3
| | | | Take the opportunity to showcase where.not.
* Uniqueness validation uses a proc to specify the `:conditions` option.Yves Senn2013-03-091-3/+7
| | | | | This is a follow up to #5321 and follows the general direction in AR to make things lazy evaluated.
* Extract some methodsCarlos Antonio da Silva2012-12-181-16/+22
|
* Change relation in placeCarlos Antonio da Silva2012-12-181-1/+1
|
* Simplify value logic by always typecastingCarlos Antonio da Silva2012-12-181-11/+5
|
* Avoid unnecessary hashes with error optionsCarlos Antonio da Silva2012-12-181-1/+4
|
* Remove prepend_and_append requirement from ASCarlos Antonio da Silva2012-12-181-3/+1
| | | | It's not necessary to use this extension here, we are fine with Array#unshift.
* Refactor uniqueness validator logic a bitCarlos Antonio da Silva2012-12-181-10/+5
| | | | | Cleanup some code, avoid extra hash with reverse_merge, and don't use send for :id, since it's always present.
* Added support for validates_uniqueness_of in PostgreSQL array columns. ↵Pedro Padron2012-12-181-1/+6
| | | | Fixes: #8075.
* Fix bug with presence validation of associations.Scott Willson2012-10-161-2/+4
| | | | Would incorrectly add duplicated errors when the association was blank. Bug introduced in 1fab518c6a75dac5773654646eb724a59741bc13.
* refactoring of uniqueness validate_eachAngelo Capilleri2012-10-141-1/+2
| | | | get scope_value only one time dependig on reflection
* small refactoring of build_relation in uniquenessAngelo Capilleri2012-09-291-5/+3
| | | | | reflection init as 'if' stantment. column is always the same expression and depends from the changing of attributes
* update AR::Validations documentation [ci skip]Francesco Rodriguez2012-09-223-16/+15
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-08-042-44/+64
|\ | | | | | | | | | | Conflicts: activemodel/lib/active_model/secure_password.rb activerecord/lib/active_record/associations/collection_proxy.rb
| * update AR::Validations::AssociatedValidator documentation [ci skip]Francesco Rodriguez2012-07-291-13/+19
| |
| * update AR::Validations::UniquenessValidator documentation [ci skip]Francesco Rodriguez2012-07-291-31/+45
| |
* | Merge pull request #6827 from zephyr-dev/masterJosé Valim2012-07-271-0/+64
|\ \ | |/ |/| Validates_presence_of associated object marked for destruction
| * AR has a subclass of AM:PresenceValidator.Brent Wheeldon & Nick Monje2012-07-201-0/+64
| | | | | | | | | | | | | | This allows us to mark the parent object as invalid if all associated objects in a presence validated association are marked for destruction. See: https://github.com/rails/rails/issues/6812
* | Fixes "Cannot visit ..." with validates_uniqueness_ofbeerlington2012-07-171-1/+1
|/ | | | | | Fixes issue with overrding ActiveRecord reader methods with a composed object and using that attribute as the scope of a validates_uniqueness_of validation.
* fix tests for SQLite3AdapterAndrey Deryabin2012-04-271-1/+0
|
* Correct grammar in documentationMattias Pfeiffer2012-03-071-1/+1
|
* Change syntax to accept an AR::Relation instead of old conditions hash/array.Mattias Pfeiffer2012-03-071-3/+9
|
* Add :conditions option to uniqueness validatorMattias Pfeiffer2012-03-071-2/+12
|
* say unshift when you mean unshift (modulus prepend)Xavier Noria2012-02-111-1/+3
|
* Remove initialize variable columnn, not neededPaco Guzman2012-01-291-2/+1
|
* validate related records in the same validation context as parent.Emmanuel Oga2012-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | E.G.: ```ruby class Parent < ActiveRecord::Base has_one :child validates_presence_of :name, :on => "custom_context" validates_associated :child end class Child < ActiveRecord::Base belongs_to :parent validates_presence_of :name, :on => "custom_context" end p = Parent.new(:name => "Montoto", :child => Child.new) p.valid?(:custom_context) # => Returns true, even though the child is not valid under the same context. ```
* allow association as 1st uniqueness validation argDan Pickett2012-01-061-1/+9
| | | #4321
* allow an association as a scope parameterDan Pickett2012-01-061-0/+5
| | | #4321
* Fixed nil field value uniqueness checkpyromaniac2012-01-061-2/+2
|
* Revert "Merge pull request #2325 from pyromaniac/master"José Valim2012-01-061-1/+1
| | | | | | | It breaks the build for mysql. This reverts commit 958d25df4a1b0d41ce5deeeb0739c93b49bbd18d, reversing changes made to 8f309e31057e1b26fefedb199ab0526126fb1fe4.
* Merge pull request #4340 from rafaelfranca/patch-1José Valim2012-01-051-4/+2
|\ | | | | Remove more Array.wrap calls
| * Whitespaces :scissors:Rafael Mendonça França2012-01-061-1/+1
| |
| * Remove Array.wrap calls in ActiveRecordRafael Mendonça França2012-01-061-3/+1
| |
* | Fixed nil field value uniqueness checkpyromaniac2012-01-061-1/+1
|/
* remove useless call to mb_charsSergey Nartimov2012-01-051-1/+1
|