diff options
author | dixpac <dino.onex@gmail.com> | 2017-05-13 13:56:37 +0200 |
---|---|---|
committer | dixpac <dino.onex@gmail.com> | 2017-05-21 18:45:59 +0200 |
commit | 4f3955657736796664aa8d6f6d149ef9b213b058 (patch) | |
tree | d9122eff4d99a7e3e3f40a374bb19402da2ca578 /activemodel/lib | |
parent | 23aa0a2bb551717f153ac75f24c017c43ab853f2 (diff) | |
download | rails-4f3955657736796664aa8d6f6d149ef9b213b058.tar.gz rails-4f3955657736796664aa8d6f6d149ef9b213b058.tar.bz2 rails-4f3955657736796664aa8d6f6d149ef9b213b058.zip |
Improving docs for callbacks execution order [ci skip]
When define callbacks latest definition on the same callback/method
overwrites previous ones.
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/callbacks.rb | 3 | ||||
-rw-r--r-- | activemodel/lib/active_model/validations.rb | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb index eac2761433..835e6f7716 100644 --- a/activemodel/lib/active_model/callbacks.rb +++ b/activemodel/lib/active_model/callbacks.rb @@ -56,6 +56,9 @@ module ActiveModel # # Would only create the +after_create+ and +before_create+ callback methods in # your class. + # + # NOTE: Calling the same callback multiple times will overwrite previous callback definitions. + # module Callbacks def self.extended(base) #:nodoc: base.class_eval do diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index d460068830..9fcde45167 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -147,6 +147,9 @@ module ActiveModel # or <tt>unless: Proc.new { |user| user.signup_step <= 2 }</tt>). The # method, proc or string should return or evaluate to a +true+ or +false+ # value. + # + # NOTE: Calling +validate+ multiple times on the same method will overwrite previous definitions. + # def validate(*args, &block) options = args.extract_options! |