aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/secure_password.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-09-03 10:14:11 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-09-03 10:14:11 -0700
commit8a9f4c6da43aac57cdb0078cee2bf35a2db3f25c (patch)
treebb3fe42359f002ea8fe2ecd0fae237b3d02f2b94 /activemodel/lib/active_model/secure_password.rb
parent867c83060398c5f2fa63df35a3d31b49549b405e (diff)
parent9b02f3f41f9be96bcc61222a8dcd197c1a2edf79 (diff)
downloadrails-8a9f4c6da43aac57cdb0078cee2bf35a2db3f25c.tar.gz
rails-8a9f4c6da43aac57cdb0078cee2bf35a2db3f25c.tar.bz2
rails-8a9f4c6da43aac57cdb0078cee2bf35a2db3f25c.zip
Merge pull request #2825 from guilleiguaran/bcrypt-ruby-comments
Add comments about bcrypt-ruby gem to SecurePassword and add it to default Gemfile
Diffstat (limited to 'activemodel/lib/active_model/secure_password.rb')
-rw-r--r--activemodel/lib/active_model/secure_password.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb
index a73276199a..7a109d9a52 100644
--- a/activemodel/lib/active_model/secure_password.rb
+++ b/activemodel/lib/active_model/secure_password.rb
@@ -10,6 +10,10 @@ module ActiveModel
# a "password_confirmation" attribute) are automatically added.
# You can add more validations by hand if need be.
#
+ # You need to add bcrypt-ruby (~> 3.0.0) to Gemfile to use has_secure_password:
+ #
+ # gem 'bcrypt-ruby', '~> 3.0.0'
+ #
# Example using Active Record (which automatically includes ActiveModel::SecurePassword):
#
# # Schema: User(name:string, password_digest:string)
@@ -28,6 +32,8 @@ module ActiveModel
# User.find_by_name("david").try(:authenticate, "notright") # => nil
# User.find_by_name("david").try(:authenticate, "mUc3m00RsqyRe") # => user
def has_secure_password
+ # Load bcrypt-ruby only when has_secured_password is used to avoid make ActiveModel
+ # (and by extension the entire framework) dependent on a binary library.
gem 'bcrypt-ruby', '~> 3.0.0'
require 'bcrypt'