SimpleCaptcha和Formtastic错误

时间:2012-08-20 18:44:45

标签: ruby-on-rails ruby gem activeadmin formtastic

我想为我的应用安装activeadmin gem,但是当我把它写入我的gemfile时:

  

gem'activeadmin'   宝石“meta_search”

当rails s,然后我得到错误,如果我从我的gemfile删除simplecaptcha一切都好,所以有一些是simplecaptcha和activeadmins formtastic宝石,如何修复它?

这是我的gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.6'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'
#gem 'haml'
gem 'haml-rails'

gem 'kaminari'
gem "galetahub-simple_captcha", :require => "simple_captcha"

gem "authlogic"
gem "rails3-generators"

gem 'activeadmin'
gem "meta_search"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

和错误:

rails s
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /media/_Projects/Amis/config/environment.rb:5)
Exiting
/home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/galetahub-simple_captcha-0.1.3/lib/simple_captcha/formtastic.rb:2:in `<module:SimpleCaptcha>': uninitialized constant Formtastic::SemanticFormBuilder (NameError)
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/galetahub-simple_captcha-0.1.3/lib/simple_captcha/formtastic.rb:1:in `<top (required)>'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/galetahub-simple_captcha-0.1.3/lib/simple_captcha/engine.rb:19:in `block in <class:Engine>'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:34:in `call'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:42:in `each'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from /media/_Projects/Amis/config/environment.rb:5:in `<top (required)>'
        from /media/_Projects/Amis/config.ru:4:in `block in <main>'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
        from /media/_Projects/Amis/config.ru:1:in `new'
        from /media/_Projects/Amis/config.ru:1:in `<main>'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in <top (required)>'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
        from /home/pavel/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

1 个答案:

答案 0 :(得分:3)

galetahub-simple_captcha已过时,因为它使用旧的formtastic构建器类(Formtastic::SemanticFormBuilder),在最近的formtastic版本中不再退出。您有以下选择:

  1. 使用另一个宝石进行验证码
  2. 使用旧版本的formtastic
  3. 猴子修补了initalizer中的验证码宝石
  4. 我会建议1.因为宝石看起来很旧并且近一年没有更新。我不推荐2.因为activeadmin也依赖于formtastic。我不推荐3.因为你不知道还有什么东西坏了。