diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-03-21 21:04:07 -0700 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-03-21 21:04:07 -0700 |
commit | 0d3cb003de66409e8deccddcf8426822a84b3930 (patch) | |
tree | 7e125e735b46b70a60b00e4ef23c4e575437d097 | |
parent | a7391f58a0189474ef93ae89541fa34f6333e786 (diff) | |
parent | 7e07b7bb5da02f63d830eb70aae2835aa7d024ed (diff) | |
download | rails-0d3cb003de66409e8deccddcf8426822a84b3930.tar.gz rails-0d3cb003de66409e8deccddcf8426822a84b3930.tar.bz2 rails-0d3cb003de66409e8deccddcf8426822a84b3930.zip |
Merge pull request #9863 from robertomiranda/require-bcrypt-ruby
Change Standard error when is required bcrypt-ruby and fails
-rw-r--r-- | activemodel/lib/active_model/secure_password.rb | 9 |
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 |