I have an action to generate pdfs with prawn
def savepdfs
respond_to do |format|
format.pdf {} # Create PDF file and saves in /pdf/print.pdf.
logger.info "::::::::::::::::: PDF COVER PAGE CREATED :::::::::::::::::"
end
end
I don't want to show the pdf to the user . Instead I just want to call this from another action
def mainaction
#I want to call something like savepdfs(:format => :pdf)
end
How do I do this ?
Wrap it as a private controller method
def savepdfs
respond_to do |format|
format.pdf { generate_pdf } # Create PDF file and saves in /pdf/print.pdf.
logger.info "::::::::::::::::: PDF COVER PAGE CREATED :::::::::::::::::"
end
end
def mainaction
generate_pdf
end
private
def generate_pdf
# Create PDF file and saves in /pdf/print.pdf.
end