ActionController :: Base的未定义方法`page_cache_extension':Class

bas*_*eck 28 ruby-on-rails ruby-on-rails-3

出于某种原因,当我运行我的应用程序时,我得到了"ActionController :: Base:Class"的"未定义的方法`page_cache_extension"错误.

奇怪的是,它似乎只是在我启动机器并启动服务器后的第一次启动时发生的.如果我刷新页面 - 它加载正常.如果我重新启动我的服务器 - 它也可以正常工作.

我在windows7上使用rails 3.0.9和ruby 1.9.2并且我认为它在我升级到3.0.7后开始发生.至少,3.0.3我没有得到这个.

这是跟踪:

[2011-06-28 15:16:39] INFO  WEBrick 1.3.1
[2011-06-28 15:16:39] INFO  ruby 1.9.2 (2011-02-18) [i386-mingw32]
[2011-06-28 15:16:39] INFO  WEBrick::HTTPServer#start: pid=5292 port=3000
[2011-06-28 15:27:18] ERROR NoMethodError: undefined method `page_cache_extension' for ActionController::Base:Class
    D:/dev/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.9/lib/action_dispatch/middleware/static.rb:21:in `call'
    D:/dev/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:168:in `call'
    D:/dev/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
    D:/dev/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/rack/log_tailer.rb:14:in `call'
    D:/dev/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/content_length.rb:13:in `call'
    D:/dev/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/handler/webrick.rb:52:in `service'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Started GET "/" for 127.0.0.1 at 2011-06-28 15:27:21 +0400
  Processing by GamesController#index as HTML
  Category Load (2.0ms)  SELECT "categories".* FROM "categories"
  Game Load (17.0ms)  SELECT "games".* FROM "games" WHERE "games"."approved" = 't' AND "games"."published" = 't' ORDER BY approved_at DESC LIMIT 3

...

Rendered games/_game.haml (7.0ms)
Rendered games/index.haml within layouts/application (574.0ms)
Completed 200 OK in 638ms (Views: 586.0ms | ActiveRecord: 28.0ms)
[2011-06-28 15:27:23] ERROR Errno::ECONNABORTED: ????????? ?? ????? ????-?????????? ????????? ????????????? ???????????.
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpresponse.rb:323:in `write'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpresponse.rb:323:in `<<'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpresponse.rb:323:in `_write_data'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpresponse.rb:295:in `send_body_string'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpresponse.rb:186:in `send_body'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpresponse.rb:103:in `send_response'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:86:in `run'
    D:/dev/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Run Code Online (Sandbox Code Playgroud)

sea*_*boy 16

我从development.rb中删除了以下行

config.action_view.debug_rjs             = true
config.action_controller.perform_caching = false
Run Code Online (Sandbox Code Playgroud)

不确定这是否正确,但它对我有用.


小智 11

升级我的操作系统后,我尝试了同样的问题.如果使用RVM完成安装,则只使用以下命令:

rvm repair all
Run Code Online (Sandbox Code Playgroud)


Mik*_*ike 1

刚刚遇到了同样的问题,我发现服务器上的数据库中没有数据 - 我的恢复失败了,因为我忘记创建数据库所需的登录角色。一旦我从备份中正确恢复了数据库,rails 就完美地工作了。

我不确定你是否遇到类似的情况,但我想我会让你知道我是如何解决这个问题的,以防万一你和我处于同一条船上:)祝你好运!