-
A PR was recently added to phlex-rails to allow it to integrate better with gems that don't output safe HTML such as Pagy. I'm just getting started with Phlex and only looked at Pagy for the first time today so my knowledge is limited but would it be possible to get Pagy to output safe HTML? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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, address that themselves by providing the I hope that clarify the matter... |
Beta Was this translation helpful? Give feedback.
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…