开发者

Missing template pages/index with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>["text/*"]

Every once in a while my app would throw the following error:

Missing template pages/index with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>["text/*"]

The weird thing is that pages/index is pretty much a static page with no logic.

class 开发者_高级运维PagesController < ApplicationController
  def index
    @pagetitle = "Homepage"
  end
end

Does anybody know which browsers request the text/* format and how to replicate and/or fix this bug?


You can try this in your controller, if it helps:

before_filter :force_request_format_to_html

private

def force_request_format_to_html
  request.format = :html
end


I'm using Mime::Type for this case in config/initializers/mime_types.rb.

Mime::Type.register "text/html", :html, %w( application/xhtml+xml text/* ), %w( xhtml )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜