Jean Boussier
c27c783a60
Fix a tiny typo in custom validators documentation
2011-11-13 22:32:00 +05:30
Evgeniy Dolzhenko
78bab03804
Use .add instead of << to add errors
2011-10-14 22:29:44 +05:30
Ben Marini
d4832f1027
Fix example code for #validates_with instance method
2011-07-25 14:21:52 -07:00
Vijay Dev
69b3c9cf9a
remove stray (
2011-06-06 22:44:02 +02:00
Ben Orenstein
f4a4d5fa1c
Change hashrocket spacing to match conventions.
2011-06-06 22:43:16 +02:00
Akira Matsuda
35c5ccb30c
Remove unneeded merge with default false options
2011-05-16 15:37:44 +09:00
Akira Matsuda
cbe1d2488b
Don't add DEFAULT_TOKENIZER to every instance of LengthValidator. Just use it only when needed.
2011-05-16 15:37:44 +09:00
Aditya Sanghi
36ee2bafec
fix typo
2011-04-29 09:53:02 +05:30
Aditya Sanghi
bf5cf5db86
:if should not fire on validations when not in context with :on
2011-04-29 02:54:37 +05:30
José Valim
7379114c2f
Remove code duplication.
2011-04-11 18:01:10 +02:00
José Valim
df5691aa94
No need to rescue here. Invoking the wrong method in an object can happen anywhere if you are not careful. In other words, test your shit.
2011-04-11 17:47:59 +02:00
José Valim
5bf3d46bec
Revert "Add :use_include option to allow user to explicitly use Range#include? method in Ruby 1.9"
...
Use :with => range.to_a instead.
This reverts commit f6540211b5 .
2011-04-11 17:41:33 +02:00
Prem Sichanugrist
f6540211b5
Add :use_include option to allow user to explicitly use Range#include? method in Ruby 1.9
...
In Ruby 1.9 we're currently use `Range#cover?` to fix the performance problem. However, there might be the case that you want to use `Range#include?` instead. This patch will give you that option.
2011-04-10 18:49:28 +08:00
Prem Sichanugrist
58594be680
Add support for proc or lambda as an option for InclusionValidator, ExclusionValidator, and FormatValidator
...
You can now use a proc or lambda in :in option for InclusionValidator and ExclusionValidator, and :with, :without option for FormatValidator
2011-04-10 18:49:28 +08:00
Santiago Pastorino
157c37f558
Refactor length validation
2011-03-12 21:12:44 -02:00
Andriy Tyurnikov
f48d3d4df6
length validation for fixnums
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-03-12 21:12:44 -02:00
Paco Guzman
8e0affbd86
Configuration options are symbols
2011-03-06 22:35:26 +01:00
Xavier Noria
f826e05835
Merge branch 'master' of git://github.com/lifo/docrails
2011-02-21 11:42:26 +01:00
Xavier Noria
b481574a33
copy-edits 8d96b89
2011-02-21 11:37:08 +01:00
Xavier Noria
e2d54fb3f1
documents the backported Range#cover?, and related stuff
2011-02-20 10:52:49 +01:00
Diego Carrion
511bf2a050
refactored ActiveModel::Validations::InclusionValidator#validate_each
...
[#6455 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-02-19 23:24:38 -02:00
Peer Allan
8d96b89110
Clarification of ActiveRecord ActiveModel validation documentation
2011-02-18 20:51:56 -06:00
Frederick Cheung
fbfa30a1ee
Change validates inclusion to use cover? for Ranges in ruby 1.9 [ #6453 state:committed]
...
Signed-off-by: Xavier Noria <fxn@hashref.com >
2011-02-18 21:32:28 +01:00
Carl Lerche
cd13fbd8d8
Optionally pass in the attribute being validated to an instance method validator
2011-02-05 16:44:35 -08:00
Carl Lerche
e9e9ed6b60
Be able to pass a validator method to #validates
2011-02-05 16:33:00 -08:00
Carl Lerche
ed7614aa7d
Provide a way to specify alternate option keys for validates
2011-02-05 16:00:57 -08:00
Carl Lerche
7176ade35b
Do not require that validation attributes be specified as symbols
2011-02-05 15:37:38 -08:00
John Firebaugh
57bc25c5f8
Use run_callbacks; the generated _run_<name>_callbacks method is not a public interface.
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-01-31 19:45:53 -02:00
Samuel Kadolph
972011a2e5
Add support for namespaced validators
...
Includes test and documentation for new feature
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-12-16 01:49:28 +05:30
Santiago Pastorino
acbabd9626
Don't compute this string again
2010-12-02 15:43:12 -02:00
Emilio Tagua
be9883b09d
Don't redefine existing attributes accessors.
2010-09-27 11:19:19 -03:00
Obie Fernandez
275f922a23
Better shortcut options for custom validators [ #5672 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-09-24 12:49:16 +02:00
Neeraj Singh
8ae913664f
remove irrelevant comments
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-09-18 20:33:40 +02:00
Subba Rao Pasupuleti
0ae81a2124
Refactoring conditional logic
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-09-01 14:00:26 +02:00
Santiago Pastorino
9992a1a4bf
type fixed
2010-08-22 19:59:36 -03:00
Neeraj Singh
2ffa50f5a9
after_validation should be called irrespective of the result of validation.
...
I confirmed that this is the behavior on 2.3.x .
[5419 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-20 11:24:43 -03:00
Xavier Noria
ea2ad26a8d
you rarely want ^ or $ in validations, use \A when you mean \A
2010-08-18 00:15:01 +02:00
Trey Bean
bee414748c
Missing object for comparison in ActiveModel::EachValidator example code.
2010-08-17 12:51:13 -06:00
Santiago Pastorino
b95d6e84b0
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
2010-08-14 13:17:32 +02:00
Subba Rao Pasupuleti
b61ff257e9
tidy up validations length code [ #5297 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-14 13:17:29 +02:00
Xavier Noria
fff917e37d
fixes a typo reported by rymai
2010-08-10 15:34:54 +02:00
José Valim
f23bc8444b
validates_length_of should not change the options hash in place. [ #5283 state:resolved]
2010-08-03 15:22:54 +02:00
José Valim
0421fb7a91
Refactor previous commit a bit [ #4057 state:resolved]
2010-06-21 12:17:24 +02:00
Jeroen van Dijk
26392c4ac5
Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options.
...
This makes it possible to pass additional options through Validators to message generation. E.g. plugin authors want to add validates_presence_of :foo, :format => "some format".
Also, cleanup the :default vs :message options confusion in ActiveModel validation message generation.
Also, deprecate ActiveModel::Errors#add_on_blank(attributes, custom_message) in favor of ActiveModel::Errors#add_on_blank(attributes, options).
Also, refactoring of ActiveModel and ActiveRecord Validation tests. Test are a lot more DRY now. Better test coverage as well now.
The first four points were reapplied from an older patch of Sven Fuchs which didn't apply cleanly anymore and was not complete yet.
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-21 11:55:21 +02:00
Xavier Noria
207fa59675
Merge remote branch 'rails/master'
...
Conflicts:
actionpack/lib/abstract_controller/base.rb
2010-06-20 23:13:19 +02:00
José Valim
0247995d05
ActiveModel::Validations::Callbacks should not be required by default.
2010-06-19 18:20:02 +02:00
Neeraj Singh
51739d3228
moving before_validation and after_validation functionality from ActiveRecord to ActiveModel
...
[#4653 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-19 17:59:52 +02:00
Rizwan Reza
3ae67fbebb
Add titles to the rest of the files in active_model/validations/*
2010-06-15 22:20:19 +04:30
Rizwan Reza
d896d8fa20
Minor doc changes to active_model/validations/confirmation.rb
2010-06-15 22:17:06 +04:30
Rizwan Reza
6907bfe1ab
Minor doc changes to active_model/validations/acceptance.rb
2010-06-15 22:13:30 +04:30