diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-07-02 14:39:41 -0700 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-07-02 15:07:57 -0700 |
commit | 9eb15ed6a08f76ef683bb10a84f824b9dc379e3a (patch) | |
tree | 4a1fd93686918c86744cfa6feca63340a8046152 /activemodel/lib/active_model | |
parent | 6ee17968db8f8a078e843cb97eb5ab62e3d021d5 (diff) | |
download | rails-9eb15ed6a08f76ef683bb10a84f824b9dc379e3a.tar.gz rails-9eb15ed6a08f76ef683bb10a84f824b9dc379e3a.tar.bz2 rails-9eb15ed6a08f76ef683bb10a84f824b9dc379e3a.zip |
Only automatically include validations when enabled
This is a follow up to #16024.
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/secure_password.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb index 88e578e626..7e179cf4b7 100644 --- a/activemodel/lib/active_model/secure_password.rb +++ b/activemodel/lib/active_model/secure_password.rb @@ -1,7 +1,6 @@ module ActiveModel module SecurePassword extend ActiveSupport::Concern - include ActiveModel::Validations # BCrypt hash function can handle maximum 72 characters, and if we pass # password of length more than 72 characters it ignores extra characters. @@ -65,6 +64,8 @@ module ActiveModel include InstanceMethodsOnActivation if options.fetch(:validations, true) + include ActiveModel::Validations + # This ensures the model has a password by checking whether the password_digest # is present, so that this works with both new and existing records. However, # when there is an error, the message is added to the password attribute instead |