尝试在Rails中设置simple_captcha时出现问题

时间:2009-11-01 00:33:58

标签: ruby-on-rails

我正在开发一个关于Rails(2.3.4)应用程序的Ruby(1.9)。我想将Captcha添加到它中,然后我运行了Simple_Captcha插件,它安装得很好但是当我尝试使用setup命令时(rake simple_captcha)我给出了下面的错误

注意:我使用rake19,因为我有两个版本的Ruby(安装了1.9和1.8.6)我运行ruby 1.9命令,添加19例如gem19 ruby​​19 rake19..etc

Macintosh-10:wisf tam$ sudo rake19 simple_captcha:setup --trace
Password:
(in /Users/tammam56/rubydev/wisf)
** Invoke simple_captcha:setup (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute simple_captcha:setup
STEP 1
===============================================================================
ruby script/generate migration create_simple_captcha_data
/Users/tammam56/rubydev/wisf/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:1:in `require': no such file to load -- rubygems (LoadError)
 from /Users/tammam56/rubydev/wisf/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:1
 from /Users/tammam56/rubydev/wisf/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:1:in `require'
 from /Users/tammam56/rubydev/wisf/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:1
 from /Users/tammam56/rubydev/wisf/config/../vendor/rails/railties/lib/initializer.rb:10:in `require'
 from /Users/tammam56/rubydev/wisf/config/../vendor/rails/railties/lib/initializer.rb:10
 from /Users/tammam56/rubydev/wisf/config/boot.rb:45:in `require'
 from /Users/tammam56/rubydev/wisf/config/boot.rb:45:in `load_initializer'
 from /Users/tammam56/rubydev/wisf/config/boot.rb:38:in `run'
 from /Users/tammam56/rubydev/wisf/config/boot.rb:11:in `boot!'
 from /Users/tammam56/rubydev/wisf/config/boot.rb:110
 from script/generate:2:in `require'
 from script/generate:2

================================DONE===========================================
#<TypeError: can't convert nil into String>

任何想法?

谢谢,

1 个答案:

答案 0 :(得分:1)

你提到过 - 我通过添加19例命令来运行ruby 1.9命令。 gem19 ruby​​19 rake19..etc

运行ruby -v

时,终端上显示的版本号是多少?

根据您在帖子中提供的错误,脚本正在尝试运行

ruby script/generate migration create_simple_captcha_data

根据您的评论,它应该看起来像

ruby19 script/generate migration create_simple_captcha_data

HTH