def verify_requested_format!
      mimes = collect_mimes_from_class_level
      collector = ActionController::MimeResponds::Collector.new(mimes, request.variant)

      unless collector.negotiate_format(request)
        raise ActionController::UnknownFormat
      end
    end
def verify_requested_format!
      mimes = collect_mimes_from_class_level
      collector = ActionController::MimeResponds::Collector.new(mimes, request.variant)

      unless collector.negotiate_format(request)
        raise ActionController::UnknownFormat
      end
    end
Before action callback that can be used to prevent requests that do not
 match the mime types defined through <tt>respond_to</tt> from being executed.

   class PeopleController < ApplicationController
     respond_to :html, :xml, :json

     before_action :verify_requested_format!
   end