Commit Graph

316 Commits

Author SHA1 Message Date
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
8e3c3b06dc Fixed numericality validator in ActiveModel to reject hex numbers for floats completely [#4622 state:commited]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-18 03:10:56 +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
Federico Brubacher
6b4e0cc526 a cloned object no longer mimics changed flags from creator , plus a test case [#4614 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 23:04:40 +02: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 bc1c8d58ec45593acba614d1d0fecb49adef08ff.
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
92160219a8 minor changes to instance level validations implementation based on feedback from José Valim 2010-05-13 13:57:37 -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 f7862b2c34b5b298bf7b937c55f0637ebfe43a25.

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
Xavier Noria
e1a0d86fe0 Merge remote branch 'rails/master' 2010-05-09 11:46:45 +02: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
Josh Kalderimis
88ad3ed8b5 removed an old unused model in the AMo tests which also removes another AR dependency 2010-05-09 00:08:11 +03:00
Josh Kalderimis
66913a76af removed use of AR in AMo tests and removed testing of scopes (:on) in individual validation tests and moved them to their own test file 2010-05-08 23:51:36 +03:00
Josh Kalderimis
82485068f8 updated AMo validations to use a context for valid? and invalid?, removing the dependency on AR 2010-05-08 23:51:28 +03:00
Santiago Pastorino
b38639ab71 typo 'Provivdes' -> 'Provides' 2010-05-05 00:55:44 -03:00
Jatinder Singh
bce2c0ce37 Active Model JSON serializer now supports custom root option
[#4515 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-04 13:17:26 -07:00
Lawrence Pit
9bd91b00b8 Favor %{} in all code instead of (deprecated) {{}} as interpolation syntax for I18n
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-03 13:37:32 +02:00
José Valim
13867a3f5f Use %{} syntax in I18n (faster) instead of {{}}. 2010-05-01 12:54:52 +02:00
Neeraj Singh
883f27aa9a test cases for record.to_xml [#458 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-30 13:19:30 +02:00
José Valim
2e9af3638d Move several configuration values from Hash to ActiveSupport::XmlMini, which both Hash and Array depends on.
Also, refactored ActiveModel serializers to just use ActiveSupport::XmlMini.to_tag. As consequence, if a serialized attribute is an array or a hash, it's not encoded as yaml, but as a hash or array.
2010-04-29 12:42:42 +02:00
Neeraj Singh
580dd3b052 array.to_xml should be able to handle all types of data elements [#4490 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-29 09:04:34 +02:00
Santiago Pastorino
ce48b3103a Makes validates_acceptance_of to not override database fields [#4460 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-28 23:12:03 +02:00
reu
77c099c231 Fix validates_numericaly_of only integer error message [#4406 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-25 10:14:15 +02:00
José Valim
9476daa829 Speed up xml serializer by computing values just once and remove unecessary code duplication. 2010-04-22 12:29:08 +02:00
Jeremy Kemper
1924cff934 Fix Active Model observer tests 2010-04-16 13:14:52 -07:00
Mislav Marohnić
c2ca73c9ee ActiveModel::Observing: stop using Observable Ruby module, re-implement notify_observers
`Observable#notify_observers` from Ruby always returns false (which halts ActiveRecord
callback chains) and has extra features (like `changed`) that were never used.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-16 13:09:07 -07:00
David Heinemeier Hansson
4c8af9bf51 Update changelogs for release 2010-04-13 12:14:54 -07:00
Ryan Bigg
d748cc3cd0 Re-define empty? for errors to check if the values inside the OrderedHash are empty rather than the OrderedHash itself. [#4356 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-10 13:21:20 +02:00
José Valim
ee309d506c Update versions (otherwise you install a gem from source as beta3 but internally it's beta2) and update CHANGELOG. 2010-04-10 12:17:34 +02:00
Santiago Pastorino
13e00ce606 fix stack trace lines on class_eval
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-09 21:28:49 +02:00
Aaron Patterson
30f3a3df77 errors.rb needs to be declared as UTF-8 [#3941 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-04-02 09:14:55 -07:00
Sam Pohlenz
3adaef8ae7 Restore changed_attributes method in ActiveModel::Dirty and loosen expectation on including class' initialize method.
[#4308 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-01 17:52:45 -07:00
David Heinemeier Hansson
f0364d87f0 Release is today, yo 2010-04-01 14:20:03 -07:00
wycats
c1883e75b3 Updated changelogs to differentiate beta1 and beta2 2010-04-01 14:04:55 -07:00
wycats
d2a48852a1 Updated changelogs 2010-04-01 13:55:06 -07:00
David Heinemeier Hansson
d956003fa4 Neat and tidy, I say 2010-04-01 13:46:04 -07:00
David Heinemeier Hansson
9b71c55d3d Make your bed and clean up your gemspecs! 2010-04-01 13:44:09 -07:00
David Heinemeier Hansson
d868cb4f8a Prep for beta2, depend on latest Bundler 2010-04-01 13:36:45 -07:00
Jeremy Kemper
7e3b4c1f2f Merge branch 'master' of github.com:rails/rails 2010-03-28 11:34:16 -07:00
Jeremy Kemper
d1f3437cac Cosmetics: mismatch indentation 2010-03-28 11:34:09 -07:00
Xavier Noria
76f024ac8d adds missing requires for Object#blank? and Object#present? 2010-03-28 14:15:02 +02:00
Xavier Noria
3b1c69d2dd adds a few requires in active_model/dirty.rb
[#4284 state:committed]
2010-03-28 12:43:20 +02:00
Jeremy Kemper
a98db7c6ef Use Array.wrap uniformly 2010-03-27 11:50:11 -07:00
Jeremy Kemper
c3cea9b594 Fix unstated dep on HWIA 2010-03-27 11:03:36 -07:00
José Valim
f1da7174cc Fix tests added in previous commit. 2010-03-27 11:04:21 +01:00