Santiago Pastorino
5fb42ac478
Tests and docs which explain the use of validate with a block and without arguments
2010-12-19 18:50:18 -02:00
Santiago Pastorino
08ccd29b5b
Remove weak_passwords list and the length/strong password validator, leave that up to the programmer
2010-12-19 15:01:29 -02:00
Mikel Lindsaar
6c217f98db
Add set_weak_passwords call in alignment with set_table_name.
2010-12-19 21:36:47 +11:00
Mikel Lindsaar
a39a333769
Added ability to specify which passwords you want as weak passwords
2010-12-19 20:39:54 +11:00
José Valim
432556b923
Make password messages translatable.
2010-12-19 09:34:31 +01:00
José Valim
d592fa946d
Avoid warnings and fix small typo on SecurePassword.
2010-12-19 09:28:15 +01:00
David Heinemeier Hansson
bd9dc4ff23
BCrypt does its own salting, lovely!
2010-12-18 19:09:07 -08:00
David Heinemeier Hansson
bcf4e4f2b0
Added ActiveRecord::Base#has_secure_password (via ActiveModel::SecurePassword) to encapsulate dead-simple password usage with SHA2 encryption and salting
2010-12-18 13:38:05 -08:00
Santiago Pastorino
9cfbada93a
This is not an executable file
2010-12-16 01:49:28 +05:30
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
7c920631ec
Test using default option as symbol added for human_attribute_name
2010-12-05 13:26:14 -02:00
Santiago Pastorino
33b0a30fcc
default could be a symbol here so attribute.to_s.humanize should be the final option
2010-12-05 12:57:45 -02:00
Santiago Pastorino
0dbf4ac709
Test falling back to default added for human_attribute_name
2010-12-05 12:36:53 -02:00
Santiago Pastorino
b870d67290
Test using default option added for human_attribute_name
2010-12-05 12:36:51 -02:00
Thilo Utke
7148b933c4
ActiveModel::Errors.to_hash returns plain OrderedHash and used in to_json serialization to properly handle multiple errors per attribute [ #5615 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-12-01 11:43:37 +01:00
José Valim
1ec126dd37
Revert "Fix generation of wrong json string when field has multiple errors"
...
This reverts commit a9b666b51d .
2010-12-01 11:42:30 +01:00
Krekoten' Marjan
a9b666b51d
Fix generation of wrong json string when field has multiple errors
2010-12-01 00:03:42 +08:00
Aaron Patterson
938243feb9
do not require ruby-debug automatically. please require it if you have declared it as a dependency
2010-11-19 16:26:09 -08:00
Jeremy Holland
ea0faa2055
Allowing to_xml :camelize option to be set to :lower to enable lower-camelcase tags [ #5903 state:resolved]
2010-11-03 10:43:45 -07:00
José Valim
232e56ce87
No need to pass self as parameter here.
2010-10-04 22:32:29 +02:00
Ernie Miller
21cb1d40b9
Test to_model being called in ActiveModel::Naming helpers
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-10-04 21:26:42 +02:00
Neeraj Singh
72c1e19c33
after_create in ActiveModel should in the order specified
...
[#5650 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-09-27 23:11:31 +02:00
John Firebaugh
75a960ca6e
Don't act destructively on ActiveModel::Name#human options hash. [ #5366 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-09-25 10:59:54 +02:00
Rodrigo Rosenfeld Rosas
8d30193b08
Properly interpolate i18n keys in modules [ #5572 state:resolved]
2010-09-24 20:41:12 +02: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
Jakub Suder
2524cf404c
fixed some issues with JSON encoding
...
- as_json in ActiveModel should return a hash
and handle :only/:except/:methods options
- Array and Hash should call as_json on their elements
- json methods should not modify options argument
[#5374 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-09-07 11:33:10 -07:00
Piotr Sarnacki
6e5aed057f
Prepared ActiveModel::Naming to handle cases for namespaced isolated engines
2010-09-03 22:59:15 +02:00
Neeraj Singh
8402488568
adding new test for ActiveModel::Serialization
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-31 17:45:03 +02:00
José Valim
f0ee4a6002
Remove deprecations in ActiveModel.
2010-08-29 20:45:34 -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
fb6b805620
code gardening: we have assert_(nil|blank|present), more concise, with better default failure messages - let's use them
2010-08-17 03:32:11 +02:00
Subba Rao Pasupuleti
b7fdc937fa
Adding missing required statement
...
[#5056 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-08-14 06:27:15 -03:00
Santiago Pastorino
b451de0d6d
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
2010-08-14 04:12:33 -03:00
Subba Rao Pasupuleti
ef0da581e9
no callbacks should be created for empty array [ #5289 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-12 13:12:26 -03:00
Greg Campbell
90a7915ab2
Add missing ActiveModel::Validations require
...
[#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 >
2010-08-12 13:11:48 -03:00
rohit
621246f997
Failing test for validates_length_of, when both too_short and too_long messages are set [ #5283 state:open]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-03 15:11:51 +02:00
Tore Darell
2c8a4a53a8
Remove or fix non-working examples and add a few tests to Dirty [ #5185 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-03 10:47:30 +02:00
Neeraj Singh
fb2b8fec24
adding test cases for ActiveModel::Errors
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-03 10:46:16 +02:00
Alex Le
aeaab06c79
ActiveModel::Errors json serialization to work as Rails 3b4 [ #5254 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-02 16:26:32 +02:00
José Valim
53310614d7
Reuse already existing classes for ActiveModel tests.
2010-07-21 13:00:56 +02:00
Piotr Sarnacki
6807b08099
Moved a few methods from RecordIdentifier to ActiveModel::Naming
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-21 11:29:58 +02:00
Santiago Pastorino
16c14f7465
Avoid interpreted as grouped expression warnings
2010-07-11 02:55:38 -03:00
Josh Kalderimis
4b66aab00f
mass_assignment_security moved from AR to AMo, and minor test cleanup
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 18:28:45 +02:00
Jeremy Kemper
d15256af6c
Missing BigDecimal dependency
2010-06-27 16:28:04 -07:00
José Valim
7bd85a8fc2
Work around the fact the JSON gem was overwriting to_json implementation for all Ruby core classes.
...
This is required because the JSON gem is incompatible with Rails behavior and was not allowing ActiveModel::Errors to be serialized.
So we need to ensure Rails implementation is the one triggered. [#4890 state:resolved]
2010-06-26 12:01:13 +02:00
Josh Kalderimis
e8c064bbe0
Regression with how base errors messages are added to a model. Works correctly for both string error messages and symbol translated messages.
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-23 14:45:55 +02:00
Neeraj Singh
c0fc084e93
should be able to run ActiveModel validations_test [ #4933 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-22 21:38:27 +02:00
Santiago Pastorino
6ea967729f
Avoid method redefined warning
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-22 15:09:01 +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
José Valim
0247995d05
ActiveModel::Validations::Callbacks should not be required by default.
2010-06-19 18:20:02 +02:00