Did you register your MIME type? Mime::Type.register "application/pdf", :pdf Not sure where this should be done in Rails 4
Per http://apidock.com/rails/ActionController/MimeResponds/respond_with: respond_with needs to be paired with respond_to And the order of your respond_with matters: you should list format.html first On Friday, June 12, 2015 at 12:42:13 PM UTC-4, itsmechlark wrote: > > 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 > > > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7e1887d0-0a5f-4ce4-8489-e5ccc552d095%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

