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
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
José Valim
a04060fb6f
Really make include_root_in_json default to true [ #3770 state:resolved]
2010-06-08 01:02:45 +02:00
Anil Wadghule
bdb2871df7
Fix xml serialization test [ #4650 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-19 13:02:13 +02:00
Neeraj Singh
b462952886
Use better assertion methods for testing
...
[#4645 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-19 10:18:36 +02:00
rohit
05e3fb45ee
Add a valid hex that shouldn't be valid to ActiveModel numericality tests [ #4622 state:commited]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-18 03:10:55 +02:00
Jeremy Kemper
5371242384
Valid hex strings aren't valid float column values, to match the integer restriction. [ #4622 state:resolved]
2010-05-17 07:58:26 -07:00
Santiago Pastorino
fdfebb7782
Make use of assert_equal to test equallity between object assert expects and object and a message of error
...
[#4611 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-16 16:06:28 +02:00
José Valim
d6cbb27e7b
Revert "Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options."
...
Having a huge array to whitelist options is not the proper way to handle this case. This means that the ActiveModel::Errors object should know about the options given in *all* validators and break the extensibility added by the validators itself. If the intent is to whitelist options before sending them to I18n, each validator should clean its respective options instead of throwing the responsibility to the Errors object.
This reverts commit bc1c8d58ec .
2010-05-15 21:55:16 +02:00
Jeroen van Dijk
bc1c8d58ec
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).
Original patch by Sven Fuchs, some minor changes and has been changed to be applicable to master again
[#4057 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-15 11:17:58 -07:00
Josh Kalderimis
9131a88bb8
validation macros can now be used within an instance
2010-05-13 13:57:37 -07:00
Santiago Pastorino
6334006b81
Revert "Refactor of active_model/naming.rb and allow collection and element to be writable"
...
This reverts commit f7862b2c34 .
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-05-12 21:02:16 +02:00
Santiago Pastorino
bea3c26833
Make ActiveResource serialize XML correctly when element_name is set.
...
[#4529 ]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-12 09:31:36 -07:00
Santiago Pastorino
f7862b2c34
Refactor of active_model/naming.rb and allow collection and element to be writable
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-05-12 09:31:30 -07:00
Josh Kalderimis
605c6455ac
removed AR from all AMo tests, including any unneeded files (schema, fixtures and test helper)
2010-05-09 00:08:11 +03:00