Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change Standard error when is required bcrypt-ruby and fails

  • Loading branch information...
commit 7e07b7bb5da02f63d830eb70aae2835aa7d024ed 1 parent ecfdc84
@robertomiranda robertomiranda 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.