将rails版本升级到3.2后无法加载

时间:2013-04-11 12:22:32

标签: ruby-on-rails asset-pipeline upgrade

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

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]}

1 个答案:

答案 0 :(得分: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