1

アプリにactiveadmin gemをインストールしたいのですが、gemfileに書き込むと:

gem 'activeadmin' gem "meta_search"

rails s を実行するとエラーが発生します。gemfile から simplecaptcha を削除しても問題ありません。simplecaptcha と activeadmins の formtastic gem に問題があります。修正方法を教えてください。

ここに私の宝石ファイルがあります:

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. キャプチャに別の宝石を使用する
  2. 古いバージョンの formtastic を使用する
  3. モンキーはイニタライザで captcha gem にパッチを当てます

1. をお勧めします。gem はかなり古いようで、1 年近く更新されていないからです。2. activeadmin も formtastic に依存するため、お勧めしません。3. はお勧めしません。他に何が壊れているのかわからないからです。

于 2012-08-20T22:52:52.487 に答える