Possible duplicate of: render default template when requested template is missing in Rails
Which says:
Use 'rescue_from' in ApplicationController:
class ApplicationController < ActionController::Base
rescue_from ActionView::MissingTemplate do |exception|
# use exception.path to extract the path information
# This does not work for partials
end
end