当一个google机器人试图访问我的一个控制器时,我收到了这个错误消息。
ActionView::MissingTemplate: Missing template channels/show, application/show with {:locale=>[:"sv-SE", :en], :formats=>["*/*;q=0.9"], :handlers=>[:erb, :builder, :haml]}. Searched in: * "/opt/www/app/releases/20120228181534/app/views" * "/opt/www/app/shared/bundle/ruby/1.9.1/gems/kaminari-0.13.0/app/views"问题是我不能复制它。根据airbrake的数据,这个错误在上周已经发生了121次。
Here是回溯。
第18行是我的应用程序中唯一提到的行,它是这段代码的super部分
def render(options = {}, extra_options = {}, &block)
if request.headers['X-PJAX'] or params[:no_layout] == "true" or params[:_pjax]
options[:layout] = false
end
super(options, extra_options, &block)
end控制器方法channels#show如下所示
def show
@channel = # ...
@today = # ...
@yesterday = # ...
@tomorrow = # ...
end访问为google bot引发错误的url不会给我带来错误。
唯一失败的urls是包含特殊字符的urls,如{"action"=>"show", "id"=>"25-jönköping", "controller"=>"channels"}。ORIGINAL_FULLPATH值设置为/channels/25-j%c3%b6nk%c3%b6ping。
我使用的是rails 3.2.1。
发布于 2012-03-26 17:40:42
这个问题最近已经在主站修复,并回传到3.2分支:原始错误报告见https://github.com/rails/rails/issues/736,猴子补丁见https://gist.github.com/1754727,接受的拉取请求见github.com/rails/rails/ pull /4918。
发布于 2012-03-26 07:30:30
我在一个Rails3应用程序上也看到过这个错误,并且在复制这个错误时也遇到过同样的情况。日志中有缺失模板的错误,但是当我手动尝试请求时,它工作得很好。
我怀疑来自Google的HTTP请求没有设置Rails正确处理的mime。我发现的原始解决方案是删除视图模板mime,因此
example/index.html.erb是现在
example/index.erb这将停止缺少模板的错误,因为该模板将用于所有mimes。
https://stackoverflow.com/questions/9561000
复制相似问题