ruby on rails - in case I have two versions of show.html.erb -
let's say, have 2 versions of show.html.erb
same model.
the first one, default, call show.html.erb
.
the second one, example - show1.html.erb
.
so, want use 1st 1 show on browser, , 2nd 1 print.
do have create method in controller?
in general possible create other views besides created scaffolding?
why not use wicked_pdf
gem: https://github.com/mileszs/wicked_pdf generate pdf print:
add mime::type.register "application/pdf", :pdf
to config/initializers/mime_types.rb
in show method:
def show respond_to |format| format.html format.pdf render :pdf => "file_name" end end end
now you'll need create show.pdf.erb
file , use printing.
Comments
Post a Comment