1

我已经将我的应用程序从 Rails 3.0 升级到 Rails 3.2,我在 CSS 中遇到了一个问题,因为它没有正确加载。在使用之前asset-pipeline,我一直在使用jammitfor assets 预编译。我在日志中发现以下消息:

Started GET "/assets/js_templates.jst" for 127.0.0.1 at 2013-04-11 17:41:59 +0530   
Processing by Jammit::Controller#package as */*     
Parameters: {"package"=>"js_templates", "extension"=>"jst"}   
Completed 200 OK in 75ms (Views: 0.2ms | ActiveRecord: 0.0ms | Solr: 0.0ms)   
Completed 500 Internal Server Error in 225ms  

ActionView::MissingTemplate (Missing template errors/page_not_found, 
application/page_not_found with {:locale=>[:en], :formats=>[:jpeg], :handlers=>[:erb, 
:builder, :coffee, :haml]}
4

1 回答 1

0

通过使用以下方法解决了这个问题:在 rails 3.0.1 中,

class ErrorsController < ApplicationController
    def page_not_found
        render :status => 404
    end
end

在 rails 3.2 中,将渲染更改为 respond_to

class ErrorsController < ApplicationController
    def page_not_found
        respond_to do |format|
        format.html { render :status => 404 }
        format.any { head :status=>404 }
    end
end
于 2013-05-23T06:48:29.717 回答