go minimal
go minimal

Reputation: 1703

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?

Upvotes: 3

Views: 812

Answers (2)

Yahor Zhuchkou
Yahor Zhuchkou

Reputation: 19

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 )

Upvotes: 0

bender
bender

Reputation: 1428

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

Upvotes: 2

Related Questions