Commit Graph

258 Commits

Author SHA1 Message Date
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
Xavier Noria
f17159b029 edit pass: the names of Rails components have a space, ie, "Active Record", not "ActiveRecord" 2010-06-14 23:22:04 +02:00
Rizwan Reza
e67c28dfe0 Added headings to serializers. 2010-06-14 13:59:55 +04:30
Rizwan Reza
7d7d54fa1f Revised the rest of the files from ActiveModel. 2010-06-14 13:56:51 +04:30
Rizwan Reza
2572af11ce Revised and added headings. 2010-06-14 13:49:01 +04:30
Rizwan Reza
de12b5e616 Revised naming.rb and lint.rb 2010-06-14 13:44:49 +04:30
Rizwan Reza
c5db6450ec Added headings and revised active_model.rb/lint.rb grammatically 2010-06-14 13:43:06 +04:30
Rizwan Reza
626586b8c7 Minor changes to active_model/errors.rb 2010-06-14 13:40:57 +04:30
Rizwan Reza
716c243def Minor changes to active_model/callbacks.rb and dirty.rb 2010-06-14 13:38:29 +04:30
Rizwan Reza
97d6778c80 Minor changes to active_model/attribute_methods 2010-06-14 13:36:05 +04:30
Rizwan Reza
4523081317 Minor changes to callbacks and conversion API docs. 2010-06-14 13:28:00 +04:30
Pavel Gorbokon
835fd07b48 Fix spelling error in ActiveModel::Conversion docs. [#4826 state:resolved] 2010-06-11 03:09:27 +03:00
José Valim
b67ec8ba20 class_attribute is not a direct replacement of class_inheritable_*.
If you are setting a hash or an array in class_attribute or you need
to freeze it, to ensure people won't modify it in place or you need
to dup it on inheritance.
2010-06-10 19:39:09 +02:00
Neeraj Singh
e11bb95d56 Validators should at model level and not at AR:Base level [Closes #4804]
[#4804 state:resolved]

Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2010-06-10 11:50:42 -04:00
David Heinemeier Hansson
32d4330b81 Get ready for beta 4 2010-06-08 14:47:02 -04:00
José Valim
a04060fb6f Really make include_root_in_json default to true [#3770 state:resolved] 2010-06-08 01:02:45 +02:00
Santiago Pastorino
b3d2080278 Observing module is using constantize 2010-06-06 22:42:28 -07:00
Xavier Noria
a0bb1dda11 revises rdoc of AMo::Error#add [#4738 state:resolved] 2010-06-01 15:44:14 +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
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
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
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 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
Xavier Noria
e1a0d86fe0 Merge remote branch 'rails/master' 2010-05-09 11:46:45 +02: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
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
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
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
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