Question

I have a set of images,I select a single image and pass the src of it to a hidden field using a form

<%= form_for(:img, method: "post", url: {action: "printer"}) do |f| %>
    <input type="hidden" id="image_attach" name="image_attach">
<%= f.submit "Print" %>
<%end%>

Next in my controller I have this

def printer
@image_file=params[:image_attach]
redirect_to(:action => "printing.pdf")
end

def printing
end

In my view I have a printing.pdf.prawn file which doesnt open.

For some reason I dont get redirected to the pdf file

I get the following error

enter image description here

My routes.rb file

Watermark::Application.routes.draw do
  root "posts#index"
  post ':controller(/:action(/:id(.:format)))'
  get ':controller(/:action(/:id(.:format)))'
end

Pas de solution correcte

Autres conseils

redirect_to(:action => "printing.pdf")

should be

redirect_to(:action => "printing")

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top