"\nrequest.variant: #{request.variant.inspect}"
raise ActionController::UnknownFormat, message
elsif interactive_browser_request?
message = "#{self.class.name}\##{action_name} is missing a template " \
"for this request format and variant.\n\n" \
My controller
respond_to do |format|
format.html
format.pdf do
pdf = Prawn::Document.new
params[:id] = @ids
@opcionales = Opcionale.where("id= ?", @ids)
...
send_data pdf.render, filename: "Reporte_#{@opcionales}.pdf",
type: "application/pdf",
disposition: "inline"
end
end
My routes
get 'reporte/opcionales'
get 'reporte/opcionales/:id', to: "reporte#opcionales", :defaults => { :format => 'pdf' }
In my views
{<%= link_to "Generar PDF", '/reporte/opcionales/'+(opcionales.id.to_s)+'.pdf' %>}
Go to config/intializers/mime_types.rb
and add Mime::Type.register "application/pdf", :pdf
and then install the gem responders