1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

10 commits

Author SHA1 Message Date
Vipul A M
6eced6a1fe Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 onwards. 2015-02-03 20:51:40 +05:30
claudiob
684cbee473 Add test for AM::Validation::Callbacks with :on
`before_validation` and `after_validation` from
ActiveModel::Validation::Callbacks accept an optional `:on` parameter
that was not previously documented or tested. For instance given

    before_validation :do_something, on: :create

then `object.valid?(:create)` will invoke `:do_something` while
`object.valid?` or `object.valid?(:anything_else)` will not.
2015-01-11 12:29:39 -08:00
claudiob
f767981286 Deprecate false as the way to halt AM validation callbacks
Before this commit, returning `false` in an ActiveModel validation
callback such as `before_validation` would halt the callback chain.

After this commit, the behavior is deprecated: will still work until
the next release of Rails but will also display a deprecation warning.

The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
2015-01-02 15:31:56 -08:00
claudiob
9a6f20e8f0 Add AM test for after_validation returning false
This stems from https://github.com/rails/rails/pull/17227#discussion_r21641358

It's simply a clarification of the current behavior by which if an
`after_validation` ActiveModel callback returns +false+, then further
`after_` callbacks **are not halted**.
2014-12-14 21:18:31 -08:00
Neeraj Singh
cf69d527fe Added tests for if condition in Active Model callbacks 2013-04-21 11:34:12 -04:00
Accessd
f35f6ab003 fix typo in callbacks test 2012-07-24 12:01:41 +04:00
prasath
bf31d7b224 Removing unwanted method and adding to accessor for getter history 2012-01-25 01:34:04 +05:30
Santiago Pastorino
6ea967729f Avoid method redefined warning
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-22 15:09:01 +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