aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations.rb
Commit message (Collapse)AuthorAgeFilesLines
* %i doesn't work on 1.9Aaron Patterson2014-07-171-1/+1
|
* check for valid options in validate methodsonnym2014-07-171-0/+6
| | | | | | | | | | | This change prevents a certain class of user error which results when mistakenly using the `validate` class method instead of the `validates` class method. Only apply when all arguments are symbols, because some validations use the `validate` method and pass in additional options, namely the `LenghValidator` via the `ActiveMode::Validations::validates_with` method.
* ActiveRecord/ActiveModel '#validate' alias for 'valid?'Henrik Nyh2014-03-271-0/+4
| | | | | | | | It's unintuitive to call '#valid?' when you want to run validations but don't care about the return value. The alias in ActiveRecord isn't strictly necessary (the ActiveModel alias is still in effect), but it clarifies.
* Fix doc markup of clear_validators!Carlos Antonio da Silva2014-01-271-2/+2
|
* Ability to specify multiple contexts when defining a validation.Vince Puzzella2014-01-271-5/+9
| | | | | | Example: validates_presence_of :name, on: [:update, :custom_validation_context]
* revises references to :allow_(nil|blank) in some docs [ci skip] [Steven Yang ↵Xavier Noria2014-01-261-2/+0
| | | | | | & Xavier Noria] Closes #11247.
* Adding missing backslashes in active_model files so as to avoid unwanted ↵aditya-kapoor2013-12-271-1/+1
| | | | links in rdoc [ci skip]
* remove some evals from callback conditionalsAaron Patterson2013-06-111-1/+3
|
* fix ActiveModel::Validations.validators_on docDaichi Arai2013-06-101-1/+0
|
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-011-1/+1
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* Tidying up some require : removing useless sort and homogenizing with the ↵Intrepidd2013-03-201-4/+1
| | | | rest of the code the wat the includes are done
* The repair_validations helper was not working correctly before becausewangjohn2013-03-191-0/+43
| | | | | | it only cleared the validations that created :validate callbacks. This didn't include the validates created by validates_with, so I've added a method to clear all validations.
* cleanup, removed dispensable `require` statements from `ActiveModel`Yves Senn2012-11-251-3/+0
|
* convert comments to 1.9 hash syntaxAvnerCohen2012-10-221-5/+5
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-10-211-1/+1
|\ | | | | | | | | | | Conflicts: activesupport/lib/active_support/core_ext/hash/slice.rb guides/source/active_support_core_extensions.md
| * minor edits in AM documentation [ci skip]Francesco Rodriguez2012-10-211-1/+1
| |
* | active_model/validations requires necessary files to runYves Senn2012-10-181-0/+1
| |
* | cleanup, replace non-breaking spaces with spacesYves Senn2012-10-181-5/+5
|/
* Use the `flat_map` method.Rafael Mendonça França2012-10-031-2/+2
| | | | Thanks to @jeremy to teach me this one.
* Revert "Merge pull request #7826 from sikachu/master-validators-kind"Rafael Mendonça França2012-10-021-14/+1
| | | | | | | | | | | | | | | | This reverts commit 4e9f53f9736544f070e75e516c71137b7eb49a7a, reversing changes made to 6b802cdb4f5b84e1bf49aaeb0e994b3be6028af9. Revert "Don't use tap in this case." This reverts commit 454d820bf0a18fe1db4c55b0145197d70fef1f82. Reason: Is not a good idea to add options to this method since we can do the same thing using method composition. Person.validators_on(:name).select { |v| v.kind == :presence } Also it avoids to change the method again to add more options.
* Don't use tap in this case.Rafael Mendonça França2012-10-021-5/+7
| | | | | The use of tap in this case is very confusing since we are mutating the return value inside the block
* Make `.validators_on` accept `:kind` optionPrem Sichanugrist2012-10-021-1/+12
| | | | | This will filter out the validators on a particular attribute based on its kind.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-08-041-35/+126
|\ | | | | | | | | | | Conflicts: activemodel/lib/active_model/secure_password.rb activerecord/lib/active_record/associations/collection_proxy.rb
| * update ActiveModel::Validations docs [ci skip]Francesco Rodriguez2012-07-291-35/+126
| |
* | load active_support/core_ext/class/attribute in active_support/railsXavier Noria2012-08-021-1/+0
|/
* Set hash value instead of merge a single key, and use flatten! if possibleCarlos Antonio da Silva2012-06-261-2/+1
| | | | | | | | There's no need to create two extra hashes with options.merge(another_hash), with the goal of setting only one value, so lets just set it. Also refactor validates_each to use _merge_attributes, like other validates_* helpers do.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-06-221-2/+15
|\
| * fixes a few mistakes in api docs [ci skip]Vijay Dev2012-06-221-1/+1
| |
| * add example to ActiveModel::Validations#validators [ci skip]Francesco Rodriguez2012-06-151-2/+15
| |
* | Simplify AR configuration code.Jon Leighton2012-06-151-2/+1
|/ | | | | Get rid of ActiveModel::Configuration, make better use of ActiveSupport::Concern + class_attribute, etc.
* Kill whitespaces :scissors:Carlos Antonio da Silva2012-05-151-2/+2
|
* clean the erros if an object that includes validations errors is duped. ↵Angelo Capilleri2012-05-131-0/+6
| | | | Fixes #5953
* minor docs improvementsOscar Del Ben2012-04-261-1/+1
|
* Add documentation for validate optionsOscar Del Ben2012-04-261-0/+13
|
* Enhance validations documentationOscar Del Ben2012-04-261-1/+1
|
* replacing ordered hash to ruby hashprasath2012-02-081-1/+1
|
* Remove Array.wrap call in ActiveModelRafael Mendonça França2012-01-061-2/+1
|
* Support configuration on ActiveRecord::Model.Jon Leighton2011-12-281-2/+3
| | | | | | | | | | | | | | | The problem: We need to be able to specify configuration in a way that can be inherited to models that include ActiveRecord::Model. So it is no longer sufficient to put 'top level' config on ActiveRecord::Base, but we do want configuration specified on ActiveRecord::Base and descendants to continue to work. So we need something like class_attribute that can be defined on a module but that is inherited when ActiveRecord::Model is included. The solution: added ActiveModel::Configuration module which provides a config_attribute macro. It's a bit specific hence I am not putting this in Active Support or making it a 'public API' at present.
* Remove extra white spaces on ActiveModel docs.Sebastian Martinez2011-05-231-1/+1
|
* :if should not fire on validations when not in context with :onAditya Sanghi2011-04-291-1/+1
|
* formatting changesVijay Dev2011-03-071-3/+3
|
* copy-edits 8d96b89Xavier Noria2011-02-211-2/+2
|
* Clarification of ActiveRecord ActiveModel validation documentationPeer Allan2011-02-181-2/+2
|
* Use map + flatten hereSantiago Pastorino2011-02-071-3/+3
|
* Find all validators for multiple attributesCarl Lerche2011-02-051-2/+4
|
* Use run_callbacks; the generated _run_<name>_callbacks method is not a ↵John Firebaugh2011-01-311-1/+1
| | | | | | public interface. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Tests and docs which explain the use of validate with a block and without ↵Santiago Pastorino2010-12-191-1/+11
| | | | arguments
* Fix syntax error in ActiveModel::Validations .validate examplefastred2010-10-011-1/+1
|
* Fixing documentation to reflect deprecated add_to_baseMikel Lindsaar2010-09-121-2/+2
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-16/+16
| | | | 's/[ \t]*$//' -i {} \;)