我想为我的应用程序安装activeadmin gem,但当我将其写入我的gemfile时:
gem“主动管理”
宝石“元搜索”
当rails出现错误时,如果我从gemfile中删除simplecaptcha一切正常,那么simplecaptcha和activeadmins formtastic gems有什么问题,如何修复它?
这是我的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>'
最佳答案
galetahub-simple_captcha
是过时的,因为它使用了一个旧的形式化生成器类(Formtastic::SemanticFormBuilder
),在最近的格式版本中它不再退出。您有以下选项:
用另一个宝石做验证码
使用旧版本的formtastic
猴子在初始化程序中修补验证码宝石
我推荐一个因为这颗宝石看起来很老了,一年都没更新。我不推荐2个因为activeadmin也依赖于formtastic我不推荐3个。因为你不知道还有什么坏了。
关于ruby-on-rails - SimpleCaptcha和Formtastic错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12043253/