Ruby double equal in views <%== pagy_info(@pagy) %>
by @rinas
Encountered <%== pagy_info(@pagy) %> today and was wondering that the double equal (==) mean
Here is what I found:
Here is what I found:
- <% %>: Executes the Ruby code within the brackets but does not print the result to the template.
- <%= %>: Executes the Ruby code and prints the result to the template, with HTML escaping.
- <%== %>: Executes the Ruby code and prints the result to the template without HTML escaping.
So, in an example that prompted me to search, pagy_info(@pagy) is being called to generate pagination information, and the == ensures that the HTML generated by pagy_info is rendered as-is in the view, allowing for proper display of pagination links or information without escaping the HTML tags.