0

Rails 2.3.8 アプリを Rails 3.0.17 にアップグレードし、Mac osx Lion 環境で RVM (Ruby 1.9.3) を使用しています。(すでにバンドラーを使用しています)。

アプリは正常に動作していますが、Rails コンソールでエラーが発生しています: (任意の DB 呼び出しで)

User.first
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
    from /Users/franklin/rails_apps/myapp/app/models/user.rb:84:in `<class:User>'
    from /Users/franklin/rails_apps/myapp/app/models/user.rb:1:in `<top (required)>'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:458:in `load'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:458:in `block in load_file'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:597:in `new_constants_in'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:457:in `load_file'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:344:in `require_or_load'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:491:in `load_missing_constant'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:183:in `block in const_missing'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:181:in `each'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.17/lib/active_support/dependencies.rb:181:in `const_missing'
    from (irb):7
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.17/lib/rails/commands/console.rb:44:in `start'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.17/lib/rails/commands/console.rb:8:in `start'
    from /Users/franklin/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.17/lib/rails/commands.rb:23:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

助けてください。

4

1 に答える 1

0

ユーザーモデルのペーパークリップ構成を修正した後、すべてが正常に機能しました。アドバイスありがとうございます。

于 2012-10-11T22:10:41.370 に答える