0

Rails バージョン 3.2.3 を 3.2.6 に更新します。サーバーを実行した後、次のエラーが発生します。

=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/dynamic_matchers.rb:50:in `method_missing': undefined method `instance' for #<Class:0x9844050> (NoMethodError)
    from /usr/local/lib/ruby/gems/1.9.1/gems/activemodel-3.2.6/lib/active_model/observing.rb:86:in `instantiate_observer'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activemodel-3.2.6/lib/active_model/observing.rb:59:in `block in instantiate_observers'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activemodel-3.2.6/lib/active_model/observing.rb:59:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activemodel-3.2.6/lib/active_model/observing.rb:59:in `instantiate_observers'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:25:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.2.6/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:34:in `call'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:42:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/prasanna/Projects/Petcare/config/environment.rb:5:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    from /home/prasanna/Projects/Petcare/config.ru:4:in `block in <main>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
    from /home/prasanna/Projects/Petcare/config.ru:1:in `new'
    from /home/prasanna/Projects/Petcare/config.ru:1:in `<main>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

環境.rb

# Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
Petcare::Application.initialize!
4

2 に答える 2

0

オブザーバーはいますか?その場合は、それらが から継承されていることを確認してActiveModel::Observerください。カスタム クラスの場合は、Singletonモジュールが含まれていることを確認してください。

于 2012-06-27T09:09:58.810 に答える
0

これは、Rails 3.x が Ruby 1.9.1 に問題があるためです。Ruby を 1.9.3 にアップデートしてみてください。

ソース: http://guides.rubyonrails.org/getting_started.html

于 2012-06-27T08:50:01.283 に答える