Doesn't respond to custom request format

I’m using *wicked_pdf* to handle PDF response but rails use HTML
response even I already set route form to “pdf”.

The pdf mime type already been registered.

At controller:

respond_to :pdf, only: :show

GET /documents/1

GET /documents/1.pdf

def show
retrieve_document_search_hits(@document)
respond_with(@document) do |format|
format.pdf { render pdf: @document.display_text }
format.html
end
end

rails v4.2.1

responders v2.1.0

Did you register your MIME type?

Mime::Type.register “application/pdf”, :pdf
Not sure where this should be done in Rails 4

Per ActionController::MimeResponds::Collector - APIdock
respond_with needs to be paired with respond_to
And the order of your respond_with matters: you should list format.html
first

Per ActionController::MimeResponds::Collector - APIdock
respond_with needs to be paired with respond_to

And the order of your respond_with matters: you should list format.pdf
last