I have pulled some records from database that look like as following and are assigned a variable called 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 liquid I want to iterate over them via loop
{% for user in users %}
{{ user.first_name }}
{% endfor %}
When I get the email where the first_name
is supposed to appear it prints out
Liquid error: internal
Liquid error: internal
What am i doing wrong here? Why the data from users
does not appear?
Where ever you are passing users
to your liquid template you need to change that to users.map(&:attributes)
to get it in the correct format, we cant just pass the users
object. After making this change then the following loop will render the data just fine.
{% for user in users %}
{{user.first_name }} {{user.last_name }}
{% endfor %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With