Groups has_ many users.
I have 2 activerecord arrays:
- groups = containing groups with its users.
- users = containing users attending an event.
I start by iterating over the groups. Then I iterate over the users in
the second array and search for that user in the first array (see
code). If the user is found, show hime and delete him from the array.
<% groups.each do |group| %>
<%= group.title %><% users.each do |user| %> # I want to search for user in group.users # and if present show here and remove the user from # group.users (remove from the array not from the database) <% end %> <% end %>
I don’t know how to find a user in another active record array and
then delete him.
All help is greatly appreciated.