aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2011-09-01 23:54:17 -0500
committerAaron Patterson <aaron.patterson@gmail.com>2011-09-02 10:01:47 -0700
commit67790644372ad3a771810f1d6d99687d795789ea (patch)
tree658300ee916018a582e00eda4cb3e9d7e2eeb5a3
parent36f1612c34577225d1f71c368e70c234d5197707 (diff)
downloadrails-67790644372ad3a771810f1d6d99687d795789ea.tar.gz
rails-67790644372ad3a771810f1d6d99687d795789ea.tar.bz2
rails-67790644372ad3a771810f1d6d99687d795789ea.zip
Remove hard dependency on bcrypt.
-rw-r--r--Gemfile1
-rw-r--r--activemodel/activemodel.gemspec1
-rw-r--r--activemodel/lib/active_model/secure_password.rb5
3 files changed, 4 insertions, 3 deletions
diff --git a/Gemfile b/Gemfile
index f0880926a3..d36aec6b4a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,6 +6,7 @@ if ENV['AREL']
gem "arel", :path => ENV['AREL']
end
+gem "bcrypt-ruby", "~> 3.0.0"
gem "jquery-rails"
# This needs to be with require false to avoid
# it being automatically loaded by sprockets
diff --git a/activemodel/activemodel.gemspec b/activemodel/activemodel.gemspec
index e5075485bb..260ad01b65 100644
--- a/activemodel/activemodel.gemspec
+++ b/activemodel/activemodel.gemspec
@@ -19,5 +19,4 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', version)
s.add_dependency('builder', '~> 3.0.0')
s.add_dependency('i18n', '~> 0.6')
- s.add_dependency('bcrypt-ruby', '~> 3.0.0')
end
diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb
index 63380d6ffd..a73276199a 100644
--- a/activemodel/lib/active_model/secure_password.rb
+++ b/activemodel/lib/active_model/secure_password.rb
@@ -1,5 +1,3 @@
-require 'bcrypt'
-
module ActiveModel
module SecurePassword
extend ActiveSupport::Concern
@@ -30,6 +28,9 @@ module ActiveModel
# User.find_by_name("david").try(:authenticate, "notright") # => nil
# User.find_by_name("david").try(:authenticate, "mUc3m00RsqyRe") # => user
def has_secure_password
+ gem 'bcrypt-ruby', '~> 3.0.0'
+ require 'bcrypt'
+
attr_reader :password
validates_confirmation_of :password