清除会阻止rails服务器运行

时间:2013-02-13 17:05:30

标签: ruby-on-rails clearance

我安装了间隙并按照“rails generate clearance:install”的最后步骤进行操作。但是,当我尝试在终端中打开时,rails服务器无法启动。

/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>'

这是我的Gemfile,里面有bcrypt gem。

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

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

您似乎正在运行gem版本0.16.3,它不支持Clearance::PasswordStrategies::BCrypt密码策略。如果升级到v1.0.0.rc1或更高,则应该可以正常工作。

0.16.3中唯一支持的密码策略是Clearance::PasswordStrategies::BlowfishClearance::PasswordStrategies::SHA1

如果您想尝试支持BCrypt的版本,可以更新Gemfile说:

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

这将拉出该存储库的特定标记。您可以不使用:tag从GitHub获取最新版本。请注意,它可能不如0.16.3稳定。