From 7e07b7bb5da02f63d830eb70aae2835aa7d024ed Mon Sep 17 00:00:00 2001 From: robertomiranda Date: Thu, 21 Mar 2013 22:51:08 -0500 Subject: Change Standard error when is required bcrypt-ruby and fails --- activemodel/lib/active_model/secure_password.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'activemodel/lib') 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 -- cgit v1.2.3