Reputation: 375
I am using wicked_pdf to render PDF. The app renders a table in HTML. This table is dynamic, in the sense that, the data in it changes every 30 seconds. When the user clicks on the "Download as PDF" link, the request goes back to the server and the HTML (slightly modified for PDF) is rendered.
But the issue is that since the request is back to the server, the data would have changed. This results in the PDF table showing values differing from the HTML table. The client doesn't want this.
Basically, they want a snapshot of the static table in PDF form, not the dynamic table. How can I do this using wicked_pdf?
Thanks, Sridhar
Upvotes: 2
Views: 647
Reputation: 83680
Common Rails way here is to use timestamps.
You should pass your actual time to your controller, so it will fetch only supposed items, like.
# views
= link_to "pdf", orders_path(updated_at: DateTime.now, format: :pdf)
# controller
orders = Order.where(updated_at >= params[:updated_at])
Upvotes: 1