Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 rails g mongoid配置错误_Ruby On Rails 3_Rubygems_Gem_Mongoid - Fatal编程技术网

Ruby on rails 3 rails g mongoid配置错误

Ruby on rails 3 rails g mongoid配置错误,ruby-on-rails-3,rubygems,gem,mongoid,Ruby On Rails 3,Rubygems,Gem,Mongoid,method_缺失:未定义的方法generators'for# (命名者) from/Library/Ruby/Gems/1.8/Gems/mongoid-2.0.0.beta.19/lib/mongoid/railtie.rb:13 from/Library/Ruby/Gems/1.8/Gems/mongoid-2.0.0.beta.19/lib/mongoid.rb:89:in require' from/Library/Ruby/Gems/1.8/Gems/mongoid-2.0.0.be

method_缺失:未定义的方法
generators'for#
(命名者) from/Library/Ruby/Gems/1.8/Gems/mongoid-2.0.0.beta.19/lib/mongoid/railtie.rb:13 from/Library/Ruby/Gems/1.8/Gems/mongoid-2.0.0.beta.19/lib/mongoid.rb:89:in
require'
from/Library/Ruby/Gems/1.8/Gems/mongoid-2.0.0.beta.19/lib/mongoid.rb:89
from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in
require' from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in
require'
from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in
每个 from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in
require'
from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in
每个 from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in
require'
from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler.rb:119:in
require' 来自/Users/shauntanislaus/Desktop/code/blog/config/application.rb:7 from/Library/Ruby/Gems/1.8/Gems/railties-3.2.6/lib/rails/commands.rb:24:in
require'
from/Library/Ruby/Gems/1.8/Gems/railties-3.2.6/lib/rails/commands.rb:24
从脚本/rails:6:in
require' 来自脚本/rails:6

如何解决此问题?

我输入了这个命令,上面出现了错误

Master:blog shauntanislaus$rails g mongoid:config

我已尝试删除gemfile.loc 捆绑安装 rails g mongoid:config再次出现此错误。还是一样

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
    Master:blog shaunstanislaus$ bundle update
    Fetching gem metadata from https://rubygems.org/.........
    Fetching gem metadata from https://rubygems.org/..
    Enter your password to install the bundled RubyGems to your system: 
    Using rake (0.9.2.2) 
    Enter your password to install the bundled RubyGems to your system: 
    Using i18n (0.6.0) 
    Using multi_json (1.3.6) 
    Using activesupport (3.2.6) 
    Using builder (3.0.0) 
    Using activemodel (3.2.6) 
    Using erubis (2.7.0) 
    Using journey (1.0.4) 
    Using rack (1.4.1) 
    Using rack-cache (1.2) 
    Using rack-test (0.6.1) 
    Using hike (1.2.1) 
    Using tilt (1.3.3) 
    Using sprockets (2.1.3) 
    Using actionpack (3.2.6) 
    Using mime-types (1.19) 
    Using polyglot (0.3.3) 
    Using treetop (1.4.10) 
    Using mail (2.4.4) 
    Using actionmailer (3.2.6) 
    Using arel (3.0.2) 
    Using tzinfo (0.3.33) 
    Using activerecord (3.2.6) 
    Using activeresource (3.2.6) 
    Using bson (1.6.4) 
    Using bson_ext (1.6.4) 
    Using bundler (1.1.5) 
    Using coffee-script-source (1.3.3) 
    Using execjs (1.4.0) 
    Using coffee-script (2.2.0) 
    Using rack-ssl (1.3.2) 
    Using json (1.7.4) 
    Using rdoc (3.12) 
    Using thor (0.15.4) 
    Using railties (3.2.6) 
    Using coffee-rails (3.2.2) 
    Using jquery-rails (2.0.2) 
    Using mongo (1.0.9) 
    Using will_paginate (3.0.3) 
    Using mongoid (2.0.0.beta.19) 
    Using rails (3.2.6) 
    Using sass (3.1.20) 
    Using sass-rails (3.2.5) 
    Using sqlite3 (1.3.6) 
    Using uglifier (1.2.7) 
    Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is                         installed.
    Master:blog shaunstanislaus$ rails g mongoid:config
    /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configuration.rb:85:in
/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in
require':/Library/Ruby/Gems/1.8/Gems/mongoid-3.0.3/lib/mongoid.rb:148:散列奇数列表(语法错误)
{to:Config})
^
/Library/Ruby/Gems/1.8/Gems/mongoid-3.0.3/lib/mongoid.rb:148:语法错误,意外的“:”,应为“}”
{to:Config})
^
from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in
require' from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in
each'
from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in
require' from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in
each'
from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in
require' from/Library/Ruby/Gems/1.8/Gems/bundler-1.1.5/lib/bundler.rb:119:in
require'
来自/Users/shauntanislaus/Desktop/code/blog/config/application.rb:7
from/Library/Ruby/Gems/1.8/Gems/railties-3.2.6/lib/rails/commands.rb:24:in
require' from/Library/Ruby/Gems/1.8/Gems/railties-3.2.6/lib/rails/commands.rb:24 来自脚本/rails:6:in'require'
从script/rails:6

删除GemFile.lock,运行bundle安装。如果您运行的是最新版本的Rails(3.2?)和Ruby(1.9.3-p),那么它应该可以工作

Mongoid的“generator”命令没有显示的原因很可能是gem没有正确地安装到rails和ruby版本

看看这个:…–多米尼克·坦克雷迪2

我已经设置好了

ruby-v

ruby 1.9.3p194(2012-04-20修订版35410)[x86_64-darwin12.0.0]

束-v

捆绑程序版本1.1.5

捆绑安装成功;rake服务器仍然给出错误消息

/Users/avaranovich/.gem/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in'require':/Users/avaranovich/.gem/gems/mongoid-3.0.4/lib/mongoid.rb:148:Hash的奇数列表(语法错误)
{to:Config})

我通过键入
bundle exec rails g mongoid:Config

删除您的GemFile.lock,运行bundle安装来解决这个问题。如果您运行的是最新版本的Rails(3.2?)和Ruby(1.9.3-p),那么它应该可以工作。看看这个:
Master:blog shaunstanislaus$ rails g mongoid:config