我的本地Rails环境有什么问题?

时间:2010-10-17 02:55:44

标签: ruby-on-rails

我在一年前开始使用Rails应用程序。这是一个Rails 2.3应用程序。

现在,其他人进行了远程更改(它在Github上,抱歉,但它是私有的)。而且我已经完成了

sudo gem update

即更新了我的所有宝石,包括Rails(至3)。

意识到这一点,我已经完成了

rake:freeze:edge RELEASE=2.3.8

或任何使此版本使用该版本的rails,希望这是解决方案。

然而,到目前为止还没有这样的运气。

尝试启动服务器时遇到错误,并尝试运行script/console(尽管更多成功)。

请注意这个确切的应用程序在EngineYard上运行正常。

服务器

 $ script/server
 => Booting Mongrel
 => Rails 2.3.8 application starting on http://0.0.0.0:3000
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 45, col 3: `' (ArgumentError)
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load'
  from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:902:in `database_configuration'
  from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:437:in `initialize_database'
  from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:141:in `process'
  from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
  from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
  from /Users/ajh/Sites/PROJECT_NAME/config/environment.rb:11
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
  from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
  from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
  from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
  from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/railties/lib/commands/server.rb:84
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
  from script/server:3

控制台:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in load':ArgumentError: syntax error on line 45, col 3: rai'

在控制台中,我尝试使用已定义的模型:

  
    

@mm = MyModel.find(:all)      NameError:未初始化的常量MyModel       来自/Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in load_missing_constant' from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in const_missing'       来自/Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in`const_missing'       来自(irb):1

  

2 个答案:

答案 0 :(得分:6)

我刚刚遇到这个错误,问题结果是我在database.yml文件中使用了tab而不是double-space。我以为我会提到它,以防其他人遇到同样的麻烦。

答案 1 :(得分:3)

我的database.yml有一个迷路end个关键字。清理该文件解决了我的问题。感谢加勒特指出我正确的方向!