无法安装simple_captcha生成未初始化的常量Sprockets :: Helpers

时间:2013-08-25 08:54:45

标签: ruby-on-rails-4 captcha

我已按照其网站上的说明添加了simple_captcha gem:

gem 'simple_captcha', :git => 'git://github.com/galetahub/simple-captcha.git'

然后我运行了bundler来安装它。

最后,当我运行以下命令时,出现错误:

 rails generate simple_captcha

.rvm/gems/ruby-1.9.3-p327@eapi4/bundler/gems/simple-captcha-e99cc7e8bf6b/lib/simple_captcha/form_builder.rb:7:in `included': uninitialized constant Sprockets::Helpers (NameError)

我在网上搜索过,无法找到遇到此问题的其他任何用户。

任何帮助表示赞赏

2 个答案:

答案 0 :(得分:8)

他们在this pull request中说该插件不支持rails 4,你可以下载他们的分支并试用它。

看看它会显示你的问题

-      base.send(:include, Sprockets::Helpers::RailsHelper)
-      base.send(:include, Sprockets::Helpers::IsolatedHelper)
+      base.send(:include, Sprockets::Rails::Helper)

https://github.com/galetahub/simple-captcha/pull/39/files

答案 1 :(得分:3)

你可以这样做,因为rails 3上不支持以前版本的simple_captcha。

Azdaroth forked of simple_captcha

gem 'simple_captcha', :git => 'git://github.com/Azdaroth/simple-captcha.git', :branch => 'rails-4'