Permalink
Browse files

Merge pull request #9863 from robertomiranda/require-bcrypt-ruby

Change Standard error when is required bcrypt-ruby and fails
  • Loading branch information...
2 parents a7391f5 + 7e07b7b commit 0d3cb003de66409e8deccddcf8426822a84b3930 @guilleiguaran guilleiguaran committed Mar 22, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 activemodel/lib/active_model/secure_password.rb
@@ -43,8 +43,13 @@ def has_secure_password(options = {})
# 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

0 comments on commit 0d3cb00

Please sign in to comment.