Ruby on rails 奇怪的RubyonRails错误

Ruby on rails 奇怪的RubyonRails错误,ruby-on-rails,ruby,activerecord,Ruby On Rails,Ruby,Activerecord,前几天,我运行了bundle安装,然后运行了rails s,得到了以下错误: /Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-1.6.0/lib/active_record/support/clean_logger.rb:5:in `remove_const': constant Logger::Format not defined (NameError) 我已经读到我可以通过进入clean_logger.r

前几天,我运行了
bundle安装
,然后运行了
rails s
,得到了以下错误:

/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-1.6.0/lib/active_record/support/clean_logger.rb:5:in `remove_const': constant Logger::Format not defined (NameError)
我已经读到我可以通过进入
clean_logger.rb
文件并注释掉那一行来解决这个问题,但我从未接触过该文件,如果我能帮助它,我不想编辑它。有人知道这个文件的作用吗?或者我如何修复它?我正在使用Ruby 1.9.2和Rails 3.1.0.rc4

更新

这是我的档案:

source 'http://rubygems.org'

gem 'rails'

gem 'sqlite3'

# Asset template engines
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-script'
gem 'uglifier'

# JavaScript
gem 'jquery-rails'

# CSS
gem 'compass', :git => "https://github.com/chriseppstein/compass.git", :branch => "rails31"

# Authentication
gem 'authlogic'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

# pagination
gem 'will_paginate'

group :development do
  gem 'rspec-rails'
  gem 'annotate-models'
  gem 'rb-fsevent'#, :require => (RUBY_PLATFORM =~ /darwin/i)
  gem 'guard-rspec'
  gem 'faker'
  gem 'word_salad'
end

group :test do
  # Pretty printed test output
  gem 'turn', :require => false
  gem 'rspec'
  gem 'webrat'
  gem 'factory_girl_rails'
end

group :deployment do
  gem 'heroku'
end
更新2

根据评论中的要求:

.rvmrc

(empty)
rvm信息

ruby-1.9.2-p180@rails31:

  system:
    uname:       "Darwin Big.local 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.6.20 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p180"
    date:         "2011-02-18"
    platform:     "x86_64-darwin10.7.0"
    patchlevel:   "2011-02-18 revision 30909"
    full_version: "ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]"

  homes:
    gem:          "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31"
    ruby:         "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180"

  binaries:
    ruby:         "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/ruby"
    irb:          "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/irb"
    gem:          "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/gem"
    rake:         "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/bin/rake"

  environment:
    PATH:         "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/bin:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/helixed/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin"
    GEM_HOME:     "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31"
    GEM_PATH:     "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@global"
    MY_RUBY_HOME: "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180"
    IRBRC:        "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/.irbrc"
    RUBYOPT:      ""
    gemset:       "rails31"
gem列表

*** LOCAL GEMS ***

actionmailer (3.1.0.rc4, 0.6.1)
actionpack (3.1.0.rc4)
activemodel (3.1.0.rc4)
activerecord (3.1.0.rc4, 1.6.0)
activeresource (3.1.0.rc4)
activesupport (3.1.0.rc4)
annotate-models (1.0.4)
ansi (1.2.5)
arel (2.1.1)
authlogic (3.0.3, 2.1.6)
bcrypt-ruby (2.1.4)
blueprint-rails (0.1.1)
builder (3.0.0)
bundler (1.0.15)
chunky_png (1.2.0)
coffee-script (2.2.0)
coffee-script-source (1.1.1)
compass (0.11.3)
compass-960-plugin (0.10.4)
configuration (1.3.1)
diff-lcs (1.1.2)
erubis (2.7.0)
execjs (1.2.0)
factory_girl (1.3.3)
factory_girl_rails (1.0.1)
faker (0.9.5)
fssm (0.2.7)
guard (0.4.2)
guard-rspec (0.4.0)
heroku (2.3.4, 2.3.3)
hike (1.1.0)
i18n (0.6.0)
jquery-rails (1.0.12, 1.0.11)
launchy (0.4.0)
mail (2.3.0)
mime-types (1.16)
multi_json (1.0.3)
nokogiri (1.4.6)
polyglot (0.3.1)
rack (1.3.0)
rack-cache (1.0.2)
rack-mount (0.8.1)
rack-ssl (1.3.2)
rack-test (0.6.0)
rails (3.1.0.rc4, 0.9.5)
railties (3.1.0.rc4)
rake (0.9.2, 0.8.7)
rb-fsevent (0.4.0)
rdoc (3.6.1)
rest-client (1.6.3)
rspec (2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
sass (3.1.3)
sass-rails (3.1.0.rc.3, 3.1.0.rc.2)
sprockets (2.0.0.beta.10)
sqlite3 (1.3.3)
term-ansicolor (1.0.5)
thor (0.14.6)
tilt (1.3.2)
treetop (1.4.9)
turn (0.8.2)
tzinfo (0.3.28)
uglifier (1.0.0, 0.5.4)
webrat (0.7.3)
will_paginate (2.3.15)
word_salad (2.0.0)

由于某些原因,您正在安装一个旧版本的activerecord,但它失败了

我要做的是首先检查您的
Gemfile.lock
文件,查看gem指定的是旧版本的activerecord。(在该文件中进行搜索。)如果可以,请注释掉使用gem文件中旧activerecord的gem,或者如果需要,使用更现代的版本或该gem的替代品。(我粗略检查了一下你的Gemfile,没有发现什么问题,也许你之前安装了一些旧东西并将其删除了?)

如果您没有看到在
Gemfile.lock
中指定的activerecord 1.6版,我会炸毁您的rvm gemset,然后从命令行重新安装。不管什么原因,你可能有一些旧东西在里面。在项目目录中,使用以下命令:

$ rvm gemset empty rails31

$ rvm gemset use rails31

$ gem install bundler

$ bundle install

祝你好运

由于某种原因,您正在安装一个旧版本的activerecord,但失败了

我要做的是首先检查您的
Gemfile.lock
文件,查看gem指定的是旧版本的activerecord。(在该文件中进行搜索。)如果可以,请注释掉使用gem文件中旧activerecord的gem,或者如果需要,使用更现代的版本或该gem的替代品。(我粗略检查了一下你的Gemfile,没有发现什么问题,也许你之前安装了一些旧东西并将其删除了?)

如果您没有看到在
Gemfile.lock
中指定的activerecord 1.6版,我会炸毁您的rvm gemset,然后从命令行重新安装。不管什么原因,你可能有一些旧东西在里面。在项目目录中,使用以下命令:

$ rvm gemset empty rails31

$ rvm gemset use rails31

$ gem install bundler

$ bundle install

祝你好运

此外,我还将核化您的
Gemfile.lock
,并指定您在Gemfile中使用的Rails版本:

gem "rails", "3.1.0.rc4"

然后通过运行
bundle

重新绑定所有内容。此外,我还将核化您的
Gemfile.lock
,并指定您在Gemfile中使用的Rails版本:

gem "rails", "3.1.0.rc4"

然后通过运行
bundle

重新绑定所有内容,为什么要使用
activerecord 1.6
?你能升级吗?老实说,我不知道。我从来没有完全搞清楚RVM。我真的不明白为什么我不能把Gemfile用在所有事情上,然后在每个项目上安装我想要的东西。当我安装rails时,我在RVM中创建了一个新的gemset,然后在上面安装最新的rails。升级我需要做什么?我做了,但是我仍然得到了完全相同的错误。请提供您的项目的
.rvmrc
文件内容以及命令
rvm info
gem list
(都在您的项目目录中)的输出。好的,我更新了我的帖子。您为什么使用
activerecord 1.6
?你能升级吗?老实说,我不知道。我从来没有完全搞清楚RVM。我真的不明白为什么我不能把Gemfile用在所有事情上,然后在每个项目上安装我想要的东西。当我安装rails时,我在RVM中创建了一个新的gemset,然后在上面安装最新的rails。我需要做什么才能升级?我做了,但我仍然得到完全相同的错误。请提供您的项目的
.rvmrc
文件内容以及命令
rvm info
gem list
(都在您的项目目录中)的输出。好的,我更新了我的帖子。它成功了!你是对的;my
Gemfile.lock
已指定1.6。我继续删除了它,然后(只是为了更好的衡量)也删除了我的rvm gemset。现在它工作得很好。谢谢你的帮助,成功了!你是对的;my
Gemfile.lock
已指定1.6。我继续删除了它,然后(只是为了更好的衡量)也删除了我的rvm gemset。现在它工作得很好。谢谢你的帮助。