Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:22:21+00:00 2026-06-03T17:22:21+00:00

Starting with Rails 3.0, from time to time, I’ve been receiving an exception notification

  • 0

Starting with Rails 3.0, from time to time, I’ve been receiving an exception notification like this:

ActionView::MissingTemplate: Missing template [...] with {:locale=>[:en],
  :formats=>[:text], :handlers=>[:erb, :builder, :haml]}. Searched in: * [...]

For instance, an arbitrary hand-written URL like http://example.com/some/path/robots.txt raises the error. Not fun.

I reported the problem in this ticket quite a long ago, and been using the patch mentioned here, but the problem persists.

https://rails.lighthouseapp.com/projects/8994/tickets/6022-content-negotiation-fails-for-some-headers-regression

A fix is suggested in this blog post,

http://trevorturk.wordpress.com/2011/12/09/handling-actionviewmissingtemplate-exceptions/

To use this:

respond_to do |format|
  format.js
end

But it doesn’t feel right to me, as I’m not interested in overloading an action with multiple formats. In my app, there are separate URLs for HTML and JSON API, so simple render should be sufficient.

Should I just swallow the exception by rescue_from ActionView::MissingTemplate and return 406 myself?

Is there a better way to handle this situation?

Or I can ask this way – in the first place, is there any real-world usefulness in raising this kind of exception on production?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:22:23+00:00Added an answer on June 3, 2026 at 5:22 pm

    If you’ve no need for formatted routes you can disable them with :format => false in your route specification, e.g.

    get '/products' => 'products#index', :format => false
    

    This will generate a RoutingError which gets converted to a 404 Not Found. Alternatively you can restrict it to a number of predefined formats:

    get '/products' => 'products#index', :format => /(?:|html|json)/
    

    If you want a formatted url but want it restricted to a single format then you can do this:

    get '/products.json' => 'products#index', :format => false, :defaults => { :format => 'json' }
    

    There are a number of valid reasons to raise this error in production – a missing file from a deploy for example or perhaps you’d want notification of someone trying to hack your application’s urls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting a new app and notice some missing documentation from the last time
I tried starting my Rails application but got this error message from Passenger: Ruby
I'm starting learning Ruby on Rails. So my application, like every Rails app, has
Okay so I was just starting this rails app and generated my first model
I want to switch an existing rails application from rspec to minitest starting with
I have been using ActiveResource in my Ruby on Rails applications for some time,
starting from the rails blog tutorial, i want to have listing and create functionality
Starting a new rails project and we have a well-thought-out color palette, and want
when starting Ruby on Rails programming, I will use rails first rails second and
I'm starting in the Rails world and i want to know how to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.