Skip to content

Should Pagy output safe HTML? #786

Answered by ddnexus
PhilT asked this question in Q&A
Discussion options

You must be logged in to vote

The output of Pagy is safe HTML, i.e. HTML that doesn't contain anything but HTML. Rails use it's own type of string object that is marked and recognized as safe by Rails itself.

In other words, the whole Rails HTML safe concept is created and consumed by Rails only. It's not a pure Ruby concept, and not even a Rack concept.

Since Pagy is a pure Ruby agnostic gem that is meant to be used by any Ruby app or script, it looks logical to handle the special case of Rails HTML right where the "special case" is constructed, in this case in Rails itself, which provides a an extremely easy (and rightly explicit) way to handle it.

Besides that, the template engines that work with Rails, e.g. ERB, a…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by PhilT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants