March 14, 2012

a bone to pick with the googlebot mobile crawler

I am spinning off my own instance of Socialite in the form of Octopus News. However, once in a while -- maybe once a day -- I would get an email nicely notifying me that an exception had just been thrown.

The exception looked like this:
A ActionView::MissingTemplate occurred in submissions#index:

 Missing template submissions/index with {:locale=>[:en, :en], :handlers=>[:rhtml, :haml, :rxml, :builder, :erb, :rjs], :formats=>["*/*;q=0.9"]} in view paths "/u/apps/octopusnews/2012_03_02/app/views", "/u/apps/octopusnews/2012_03_02/vendor/bundle/ruby/1.8/gems/kaminari-0.13.0/app/views", "/u/apps/octopusnews/2012_03_02/vendor/bundle/ruby/1.8/gems/devise-1.2.1/app/views"
 vendor/bundle/ruby/1.8/gems/actionpack-3.0.5/lib/action_view/paths.rb:15:in `find'

And the user in question is actually the googlebot mobile crawler. To fix this, apply the following gist. The gist is a monkey patch of the Mime module that will allow your Rails app to parse the request header coming in from the googlebot.

It is good to know that the exception emails are relevant again.

No comments: