Help with PDF Writer and link_to

I have this code in the controller:

def search2
@repair_tickets =
RepairTicket.search(params[:search][:client_id],params[:search][:product_id],params[:search][:status_id],params[:search][:pos_breakdown_id],params[:search][:breakdown_id],params[:search][:query])
respond_to do |format|
format.html
format.pdf do
send_data SearchRepairTicketDrawer.draw(@repair_tickets),
:filename => ‘repair_tickets/search2/@repair_tickets.pdf’, :type =>
‘application/pdf’, :disposition => ‘inline’
end
end
end

And I have this code in search2.html.erb:

<%= link_to 'PDF Format', formatted_repair_ticket_path(@repair_tickets, :pdf) %>

I want this last link to link to the pdf wich I create in search2
method. If I quit the format.html line, it generates the pdf I want, but
i want a link to do it. Help!

I have tried this link_to:

<%= link_to 'PDF Format', :controller => "repair_tickets", :action => "search2", :format => "pdf" %>

Then I get that search2.pdf doesn’t exist, but it i quit the line
format.html, I get the pdf (but in the line of the explorer I don’t get
.pdf)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs