I am attempting to do something like the below in my eex template:
<% current_production_date = nil %>
<%= for widget <- @widgets do %>
<%= if (current_production_date != widget.production_date) do %>
<!-- ... output a new date header and re-assign current production_date -->
<% current_production_date = widget.production_date %>
<% end %>
<%= render "_widget.html", widget: widget %>
<% end %>
This won't work as the outer "current_production_date" variable can't be re-assigned inside the comprehension. This seems like a common scenario thou, so I imagine there is a straight-forward way of accomplishing this... I just can't figure it out... any hints much appreciated!