aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRobin Dupret <robin.dupret@gmail.com>2017-05-21 21:34:47 +0200
committerGitHub <noreply@github.com>2017-05-21 21:34:47 +0200
commit0cbb130cf56812328f8aad305f2ef30c83ea33ad (patch)
tree31cd062e0e626ef978dfaadf4d6c1634ed4b985c /activemodel/lib
parent36d53f557d6478cd47ca5134468b70d8a1303664 (diff)
parent4f3955657736796664aa8d6f6d149ef9b213b058 (diff)
downloadrails-0cbb130cf56812328f8aad305f2ef30c83ea33ad.tar.gz
rails-0cbb130cf56812328f8aad305f2ef30c83ea33ad.tar.bz2
rails-0cbb130cf56812328f8aad305f2ef30c83ea33ad.zip
Merge pull request #29072 from dixpac/dixpac/add_documentation_for_validate_and_callback_order_of_execution
Improving docs for callbacks execution order [ci skip]
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/callbacks.rb3
-rw-r--r--activemodel/lib/active_model/validations.rb3
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!