aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-03-27 14:02:55 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-03-27 14:02:55 -0300
commit56dabd84da2c918c599b990c8ec8e0ceeb5c9ef5 (patch)
treed2fe1fcc48ea68276cb41918249fc20b95b3252c /activemodel/lib
parent5bf38ffc4f853a6ccc5812f0ed8341776b117aea (diff)
parent2e70f44123cb6fab9124b52a6cc02ff453b8397f (diff)
downloadrails-56dabd84da2c918c599b990c8ec8e0ceeb5c9ef5.tar.gz
rails-56dabd84da2c918c599b990c8ec8e0ceeb5c9ef5.tar.bz2
rails-56dabd84da2c918c599b990c8ec8e0ceeb5c9ef5.zip
Merge pull request #14456 from henrik/add-validate-method
ActiveRecord/ActiveModel '#validate' alias for 'valid?'
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/validations.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb
index e9674d5143..cf97f45dba 100644
--- a/activemodel/lib/active_model/validations.rb
+++ b/activemodel/lib/active_model/validations.rb
@@ -285,6 +285,8 @@ module ActiveModel
# Runs all the specified validations and returns +true+ if no errors were
# added otherwise +false+.
#
+ # Aliased as validate.
+ #
# class Person
# include ActiveModel::Validations
#
@@ -319,6 +321,8 @@ module ActiveModel
self.validation_context = current_context
end
+ alias_method :validate, :valid?
+
# Performs the opposite of <tt>valid?</tt>. Returns +true+ if errors were
# added, +false+ otherwise.
#