Skip to content

Commit

Permalink
Change Standard error when is required bcrypt-ruby and fails
Browse files Browse the repository at this point in the history
  • Loading branch information
robertomiranda committed Mar 22, 2013
1 parent ecfdc84 commit 7e07b7b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions activemodel/lib/active_model/secure_password.rb
Expand Up @@ -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

Expand Down

0 comments on commit 7e07b7b

Please sign in to comment.