Will always return true and erase the entire array
<% users.delete_if do |user| %> <% false %> <% end %>
On the other hand
<% users.delete_if do |user| false end %>
works and does not delete the array.
Can i somehow use the delete_if statement in my view and still be able to insert html?
Thanks
You shouldn’t be modifying data at all in your views — do this in your controller or model instead. Use views only to reflect the current state of your database, not change it.
If you then use the second version of your code in either of those places, this problem will disappear.