aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorrobertomiranda <rjmaltamar@gmail.com>2013-03-21 22:51:08 -0500
committerrobertomiranda <rjmaltamar@gmail.com>2013-03-21 22:52:42 -0500
commit7e07b7bb5da02f63d830eb70aae2835aa7d024ed (patch)
treef13a1575eb72ded090b562a5515e1713923ac04b /activemodel/lib
parentecfdc842a58816540e7c96a913f95a0d94be7ca7 (diff)
downloadrails-7e07b7bb5da02f63d830eb70aae2835aa7d024ed.tar.gz
rails-7e07b7bb5da02f63d830eb70aae2835aa7d024ed.tar.bz2
rails-7e07b7bb5da02f63d830eb70aae2835aa7d024ed.zip
Change Standard error when is required bcrypt-ruby and fails
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/secure_password.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb
index 9324a1ad0a..abbf96650e 100644
--- a/activemodel/lib/active_model/secure_password.rb
+++ b/activemodel/lib/active_model/secure_password.rb
@@ -43,8 +43,13 @@ module ActiveModel
# Load bcrypt-ruby only when has_secure_password is used.
# This is to avoid ActiveModel (and by extension the entire framework)
# being dependent on a binary library.
- gem 'bcrypt-ruby', '~> 3.0.0'
- require 'bcrypt'
+ begin
+ gem 'bcrypt-ruby', '~> 3.0.0'
+ require 'bcrypt'
+ rescue LoadError => e
+ $stderr.puts "You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+ end
attr_reader :password