ActionView::MissingTemplate:缺少模板 [英] ActionView::MissingTemplate: Missing template

查看:68
本文介绍了ActionView::MissingTemplate:缺少模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当 Google 机器人尝试访问我的一个控制器时,我收到此错误消息.

I'm getting this error message when a google bot tries to visit one of my controllers.

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"

问题是我无法重现它.该错误在上周发生了 121 次(根据 airbrake).

The problem is that I can't reproduce it. The error has occurred 121 times the last week (according to airbrake).

这里是回溯.

第 18 行,这是我的应用程序中唯一提到的行,是此代码的 super 部分

Row 18, which is the only row mentioned that exists in my app, is the super part of this code

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看起来像这样

The controller method channels#show looks like this

def show
  @channel   = # ...
  @today     = # ...
  @yesterday = # ...
  @tomorrow  = # ...
end

访问为 google bot 引发错误的 url 不会为我引发错误.

Visiting the url that raised the error for the google bot doesn't raise an error for me.

唯一失败的网址是包含特殊字符的网址,例如 {"action"=>"show", "id"=>"25-jönköping", "controller"=>"channels"}.ORIGINAL_FULLPATH 值设置为 /channels/25-j%c3%b6nk%c3%b6ping.

The only urls that fails is the one that contains special char like {"action"=>"show", "id"=>"25-jönköping", "controller"=>"channels"}. The ORIGINAL_FULLPATH value is set to /channels/25-j%c3%b6nk%c3%b6ping.

我使用的是 Rails 3.2.1.

I'm using rails 3.2.1.

推荐答案

最近在 master 中修复了这个问题并移植到 3.2 分支:请参阅 https://github.com/rails/rails/issues/736 以获取原文错误报告,https://gist.github.com/1754727 用于猴子补丁和 github.com/rails/rails/pull/4918 用于接受的拉取请求.

This has been recently fixed in master and back-ported to 3.2 branch: See https://github.com/rails/rails/issues/736 for the original bug report, https://gist.github.com/1754727 for monkey patches and github.com/rails/rails/pull/4918 for accepted pull request.

这篇关于ActionView::MissingTemplate:缺少模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆