Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

Change Standard error when is required bcrypt-ruby and fails
  • Loading branch information...
commit 0d3cb003de66409e8deccddcf8426822a84b3930 2 parents a7391f5 + 7e07b7b
@guilleiguaran guilleiguaran authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 activemodel/lib/active_model/secure_password.rb
View
9 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
Please sign in to comment.
Something went wrong with that request. Please try again.