質問

I installed clearance and followed the last steps which were "rails generate clearance:install". However rails server does not start up for me when I try to open in terminal.

/Users/lexi87/areyoutaken/config/initializers/clearance.rb:4:in `block in <top (required)>': uninitialized constant Clearance::PasswordStrategies::BCrypt (NameError)
    from /Users/lexi87/.rvm/gems/ruby-1.9.3-p374/gems/clearance-0.16.3/lib/clearance/configuration.rb:36:in `configure'
    from /Users/lexi87/areyoutaken/config/initializers/clearance.rb:1:in `<top (required)>'
    from /Users/lexi87/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.12/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'

Here's my Gemfile and I have bcrypt gem inside.

source 'https://rubygems.org'

gem 'rails', '3.2.12'
gem 'bootstrap-sass', '2.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'jquery-rails', '2.0.2'
gem 'annotate', '2.5.0'
gem 'clearance'

group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
  gem 'guard-rspec', '1.2.1'
  gem 'guard-spork', '1.4.2'  
  gem 'spork', '0.9.2'
  gem 'rb-fsevent', '~> 0.9.1'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

group :test do
  gem 'capybara', '1.1.2'
  gem 'factory_girl_rails', '4.1.0'
  gem 'cucumber-rails', '1.2.1', :require => false
  gem 'database_cleaner', '0.7.0'
  # gem 'launchy', '2.1.0'
  # gem 'rb-fsevent', '0.9.1', :require => false
  gem 'growl', '1.0.3'
end

group :production do
  gem 'pg', '0.12.2'
end

Any help would be greatly appreciated.

役に立ちましたか?

解決

You appear to be running gem version 0.16.3 of clearance, which doesn't support the Clearance::PasswordStrategies::BCrypt password strategy. If you upgrade to v1.0.0.rc1 or higher than that should work.

The only supported password strategies in 0.16.3 are Clearance::PasswordStrategies::Blowfish and Clearance::PasswordStrategies::SHA1.

If you want to try a version that supports BCrypt, you can update your Gemfile to say:

gem 'clearance', :git => "git://github.com/thoughtbot/clearance.git", :tag => "v1.0.0.rc4"

That will pull a specific tag of that repository. You can leave off the :tag to grab the latest version from GitHub. Keep in mind, that it may not be as stable as 0.16.3.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top