Rails - Loop does not print data in liquid template

I pulled some records from the database that look like the following, and they are assigned a variable named users

[#
<User id: 53433, first_name: "Hรฉctor", last_name: "Pinzon">,
<User id: 53434, first_name: "Hรฉctor 2", last_name: "Pinzon 2">,
]

Inside the fluid I want to loop through the loop

{% for user in users %}
{{ user.first_name }}
{% endfor %}

When I receive an email where it is supposed first_name, it displays

 Liquid error: internal 
 Liquid error: internal

What am I doing wrong here? Why data is usersnot displayed?

+4
source share
1 answer

Wherever you go usersto your liquid template, you need to change it to users.map(&:attributes), in order to get it in the correct format, we cannot just transfer the object users. After making this change, the next cycle will make the data very accurate.

{% for user in users %}
{{user.first_name }} {{user.last_name }}
{% endfor %}
+2

Source: https://habr.com/ru/post/1682186/


All Articles