Working with rails 3.1 here.
I’m wondering if there are any best practices for defining routes for views are meant to be sent to the printer. For instance, I have a report at “/daily” which has a print function that opens up a new nicely formatted printer view.
What URL should this view sit on? Couple ideas are:
- /daily/print
- /daily?media=print
What have other people used?
Either is fine.
Probably the main consideration is whether your app is public facing and accessible to search engines. Typically you want to prevent them from indexing (duplicate) content, which a printable version would be, and typically it’s easier to exclude search engines (using the robots.txt file) from printable content if it’s part of the path, as opposed to the query-string.
Otherwise, it’s easier to just tack on the query string parameter and use that to set the printable version of your stylesheet and/or views. This approach saves having to create a new route, which may be more flexible.