aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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 {} \;)
* Add missing ActiveModel::Validations requireGreg Campbell2010-08-121-0/+1
| | | | | | | | | | | [#5311 state: resolved] ActiveModel::Validations uses Hash#except, but does not require it from ActiveSupport. (This wasn't showing up in the tests, because it was required in the helper, and was also required in ActiveModel::Serialization). Signed-off-by: José Valim <jose.valim@gmail.com>
* Freeze options so we raise an error when people modify it in place.José Valim2010-08-031-2/+4
|
* edit pass to apply API guideline wrt the use of "# =>" in example codeXavier Noria2010-07-301-11/+7
|
* Merge remote branch 'rails/master'Xavier Noria2010-06-201-2/+9
|\ | | | | | | | | Conflicts: actionpack/lib/abstract_controller/base.rb
| * ActiveModel::Validations::Callbacks should not be required by default.José Valim2010-06-191-1/+18
| |
| * moving before_validation and after_validation functionality from ↵Neeraj Singh2010-06-191-12/+2
| | | | | | | | | | | | | | | | ActiveRecord to ActiveModel [#4653 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* | Fix a bunch of minor spelling mistakesEvgeniy Dolzhenko2010-06-151-2/+2
|\ \ | |/ |/|
| * Fix a bunch of minor spelling mistakesEvgeniy Dolzhenko2010-06-111-2/+2
| |
* | Revised the rest of the files from ActiveModel.Rizwan Reza2010-06-141-17/+23
|/
* class_attribute is not a direct replacement of class_inheritable_*.José Valim2010-06-101-5/+11
| | | | | | If you are setting a hash or an array in class_attribute or you need to freeze it, to ensure people won't modify it in place or you need to dup it on inheritance.
* Validators should at model level and not at AR:Base level [Closes #4804]Neeraj Singh2010-06-101-1/+1
| | | | | | [#4804 state:resolved] Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* minor changes to instance level validations implementation based on feedback ↵Josh Kalderimis2010-05-131-1/+2
| | | | from José Valim
* validation macros can now be used within an instanceJosh Kalderimis2010-05-131-6/+3
|
* updated AMo validations to use a context for valid? and invalid?, removing ↵Josh Kalderimis2010-05-081-5/+12
| | | | the dependency on AR
* Makes validates_acceptance_of to not override database fields [#4460 ↵Santiago Pastorino2010-04-281-0/+3
| | | | | | state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Use Array.wrap uniformlyJeremy Kemper2010-03-271-1/+2
|
* Remove reference to unexistent methods and fix typo.José Valim2010-03-261-1/+0
|
* Accept array of attributes as arg also, like 2.3Jeremy Kemper2010-02-251-1/+1
|