Robot causing MissingTemplate by sending :formats=>["text/*"], :locale=>[:en, :en]

Our production site occasionally gets the following error, which sends
everyone on the team an email:

Started GET “/” for 64.214.53.2 at 2011-05-13 10:53:16 -0400
Processing by HomeController#index as
etc…
ActionView::MissingTemplate (Missing template home/index with
{:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml],
:formats=>[“text/*”], :locale=>[:en, :en]} in view paths “etc…”)

Of course, if you browse to that page it comes up fine. I have two
questions:

  1. How can I reproduce this? Is there some way I can request the page,
    either through a browser or with curl or something else, that would
    set the request headers in a way that would trigger this error?

  2. How do I fix this? I’ve googled around and the suggestion seems to
    be to create another view with “.en” in the file name. That seems
    really wrong to me.

Thanks for any insight about what is going on. The server is CentOS,
with Apache and Passenger. The app is Rails 3 and has happened with a
few versions: 3.0.3, 3.0.5, and 3.0.7. The app is fairly old, but I
think I created a blank project in Rails 3.0 beta, then dragged all my
old code to the new project.

I’ve got the same problem. Maybe a before_filter method could solve
it? See:
http://stackoverflow.com/questions/5557010/missing-template-blogs-index-on-ruby-on-rails-project

But this seems to be limited to controllers who don’t respont to
different formats.

“But this seems to be limited to controllers who don’t respond to
different formats.”

That sounds like a clue. These actions don’t. I’ll put this at the
bottom of the controllers and see if that helps:

respond_to do |format|
format.html
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs