Repository is archived
No commit activity in last 3 years
No release in over 3 years
Modifies ActionController::Base such that, in production, ActionView::MissingTemplate exceptions are caught and an HTTP 406-Not Acceptable response is rendered.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 1.1
~> 0.42

Runtime

~> 4.0
 Project Readme

Rails 4 Plugin: missing_template_406

Gem Build Status

Modifies ActionController::Base such that, in production, ActionView::MissingTemplate exceptions are caught and an HTTP 406-Not Acceptable response is rendered.

This gem is verified to work with the build matrix including Rails 4.0.X, 4.1.X, 4.2.X (X being latest), and Ruby 2.0.0, 2.1.10, 2.2.5, 2.3.1.

Rails 5 raises a ActionController::UnknownFormat when attempting to request a format that does not have a template. In production mode, this exception is implicitly converted to a 406-Not Acceptable HTTP response. As a result of Rails 5 including the desired behavior, the 406 response, this gem will fail to install when included in a Rails 5 gemfile.

Usage

To take advantage of this plugin simply add missing_template_406 to your gemfile:

gem 'missing_template_406'

Motivation

Motivation for this plugin stemmed from this blog post by Robert Pankowecki:
http://blog.arkency.com/2016/07/respond-to-format-is-useful-even-without-multiple-formats/