1

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

宝石“活动管理员”宝石“元搜索”

当rails s,然后我得到错误,如果我从我的gemfile中删除simplecaptcha一切正常,那么simplecaptcha和activeadmins formtastic gems,如何解决它?

这是我的宝石文件:

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

1 回答 1

3

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

  1. 使用另一个 gem 进行验证
  2. 使用旧版本的 formtastic
  3. 猴子在初始化程序中修补验证码宝石

我会推荐 1. 因为 gem 看起来很旧,并且已经有将近一年没有更新了。我不推荐 2. 因为 activeadmin 也依赖于 formtastic。我不会推荐 3. 因为你也不知道还有什么坏了。

于 2012-08-20T22:52:52.487 回答