aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify number parsing logic in numericality validationCarlos Antonio da Silva2013-11-151-10/+3
|
* Avoid creation of extra hash with merge just to set a valueCarlos Antonio da Silva2013-11-151-1/+3
|
* Let validates_inclusion_of accept Time and DateTime rangesAkira Matsuda2013-10-231-5/+11
| | | | fixes 4.0.0 regression introduced in 0317b93c17a46d7663a8c36edc26ad0ba3d75f85
* remove evals from AM::Validations::CallbacksSteven Yang2013-06-301-1/+3
| | | | follow the same refactor at a63a964a5d1ed02cf0df1b1a33a96ed2a9fa987b
* provide a more sementicthe local variables name for ↵Steven Yang2013-06-291-8/+8
| | | | | | | ActiveModel::Validations::Clusivity#include? method the original name `exclusion` is a bit confusing when using with the method `inclusion_method` rename it to a more logic neutral name.
* Use Range#cover? for Numeric ranges (tests via endpoints) and use ↵Charles Bergeron2013-05-272-4/+5
| | | | | | Range#include? for non-numeric ranges added changelog message
* deprecate Validator#setup (to get rid of a respond_to call). validators do ↵Nick Sutterer2013-05-233-3/+12
| | | | their setup in their constructor now.
* deprecating string based terminatorsAaron Patterson2013-05-141-1/+4
|
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-019-15/+15
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* `validates_confirmation_of` does not override writer methods.Yves Senn2013-03-041-1/+5
|
* Reduce number of Strings a bitAkira Matsuda2013-01-072-3/+3
|
* Revert the change at ActiveModel::Errors#add_on_blank and fix in theRafael Mendonça França2012-12-261-2/+2
| | | | | | | | | | | right place. The EachValidator#validate already handle :allow_blank and :allow_nil, correctly. Closes #8622. Fix #8621.
* Use :present as key for the absence validatior messageRafael Mendonça França2012-12-211-1/+1
|
* Remove ActiveModel::Errors#add_on_present method.Rafael Mendonça França2012-12-211-2/+2
| | | | | | | | We don't need to define a new method in ActiveMode::Errors for each validatior. See https://github.com/rails/rails/commit/d72a07f1d1478db9daed847eadb35bfd840674f6#commitcomment-2325333
* Add `ActiveModel::Validations::AbsenceValidator`, a validator to check the ↵Roberto Vasquez Angel2012-12-151-0/+31
| | | | | | absence of attributes. Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
* Merge pull request #7282 from xHire/validates_length_of_fixRafael Mendonça França2012-11-261-2/+14
|\ | | | | | | | | | | | | Length validation handles correctly nil. Fix #7180 Conflicts: activemodel/CHANGELOG.md
| * Length validation handles correctly nil. Fix #7180Michal Zima2012-11-261-2/+14
| | | | | | | | When nil or empty string are not allowed, they are not valid.
* | cleanup, removed dispensable `require` statements from `ActiveModel`Yves Senn2012-11-251-2/+0
| |
* | cleanup, remove broken whitespaceYves Senn2012-11-251-2/+2
|/
* Set hash value instead of using merge!Carlos Antonio da Silva2012-11-041-1/+1
|
* minor edits and remove mixed titles in AM::Validations docs [ci skip]Francesco Rodriguez2012-10-259-21/+13
|
* minor edits in AM documentation [ci skip]Francesco Rodriguez2012-10-218-12/+12
|
* Switch to using include? on validation callbacksJohn Foley2012-09-231-2/+2
|
* Fix collisions with before and after validation callbacks.John Foley2012-09-231-2/+6
| | | | | | This commit allows a user to do something like: before_validation :do_stuff, :on => [ :create, :update ] after_validation :do_more, :on => [ :create, :update ]
* remove '.rb' from require callNihad Abbasov2012-09-121-1/+1
|
* Added forgotten :message option to ActiveModel validates documentationAnatoly Makarevich2012-09-071-3/+3
|
* Accept a symbol for `:in` option on inclusion and exclusion validatorsGabriel Sobrinho2012-08-243-5/+14
|
* AM::Validation#validates: ability to pass custom exception to `:strict` optionBogdan Gusiev2012-08-061-2/+5
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-08-043-65/+130
|\ | | | | | | | | | | Conflicts: activemodel/lib/active_model/secure_password.rb activerecord/lib/active_record/associations/collection_proxy.rb
| * fix #after_validation example [ci skip]Francesco Rodriguez2012-07-301-1/+1
| |
| * update ActiveModel::Validations::Callbacks documentation [ci skip]Francesco Rodriguez2012-07-291-18/+69
| |
| * update #validates and #validates! documentation [ci skip]Francesco Rodriguez2012-07-291-31/+43
| |
| * update ActiveModel::Valdations#validates_with docs [ci skip]Francesco Rodriguez2012-07-291-16/+18
| |
* | Merge pull request #7253 from acapilleri/lenght_validator_errors_optionsRafael Mendonça França2012-08-031-2/+2
|\ \ | | | | | | calculate errors_options one time in validate_each
| * | calculate errors_options one time in validate_eachAngelo Capilleri2012-08-031-2/+2
| |/ | | | | | | | | | | errors_options is calculated for every *CHECKS* but it could be calculated one time because options and RESERVED_OPTIONS not change during this cycle
* / load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|/
* Update documentation and change the range method name to delimiter.Rafael Mendonça França2012-07-203-5/+7
|
* Don't pass `:within` option to the i18nRafael Mendonça França2012-07-202-2/+2
|
* `validates_inclusion_of` and `validates_exclusion_of` now acceptRafael Mendonça França2012-07-201-3/+6
| | | | | | `:within` option as alias of `:in` as documented. Fix #7118
* AM::Validations: remove documentation duplicatesBogdan Gusiev2012-07-109-119/+52
|
* add :nodoc: to internal implementations of AM::Validator [ci skip]Francesco Rodriguez2012-07-061-1/+1
|
* fix syntax of AM::Validations::HelperMethods examples [ci skip]Francesco Rodriguez2012-07-054-6/+6
|
* update ActiveModel::Validations::HelperMethods documentation [ci skip]Francesco Rodriguez2012-07-058-130/+141
|
* Use default + merge! instead of reverse_mergeCarlos Antonio da Silva2012-06-261-1/+1
| | | | | Since we're not directly requiring the reverse_merge extension, we can avoid another hash creation by using default_hash.merge! instead.
* Set hash value instead of merge a single key, and use flatten! if possibleCarlos Antonio da Silva2012-06-261-2/+4
| | | | | | | | 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.
* add :nodoc: to internal implementations [ci skip]Francesco Rodriguez2012-06-259-16/+16
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-06-142-4/+3
|\
| * Range#cover? is not implemented in AS nowAkira Matsuda2012-06-122-4/+3
| |
* | prevent users from unknowingly using bad regexps that can compromise ↵MrBrdo2012-06-141-3/+20
|/ | | | security (http://homakov.blogspot.co.uk/2012/05/saferweb-injects-in-various-ruby.html)
* Don't enable validations when passing false hash values to ActiveModel.validatesSteve Purcell2012-05-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing a falsey option value for a validator currently causes that validator to be enabled, just like "true": ActiveModel.validates :foo, :presence => false This is rather counterintuitive, and makes it inconvenient to wrap `validates` in methods which may conditionally enable different validators. As an example, one is currently forced to write: def has_slug(source_field, options={:unique => true}) slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? } before_validation slugger validations = { :presence => true, :slug => true } if options[:unique] validations[:uniqueness] = true end validates :slug, validations end because the following reasonable-looking alternative fails to work as expected: def has_slug(source_field, options={:unique => true}) slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? } before_validation slugger validates :slug, :presence => true, :slug => true, :uniqueness => options[:unique] end (This commit includes a test, and all activemodel and activerecord tests pass as before.)