Skip to content

Instantly share code, notes, and snippets.

@SemperEadem
Created February 6, 2014 14:38
Show Gist options
  • Save SemperEadem/8845405 to your computer and use it in GitHub Desktop.
Save SemperEadem/8845405 to your computer and use it in GitHub Desktop.
<% categories.each do |category| %>
<% card_ids = [] %>
<% cards = Card.joins(:card_types).where(card_types: {id: category.card_type_ids}) %>
<% cards.find_each do |card| %>
<% card_ids << card.id unless card_ids.include?(card.id) %>
<% end %>
<% category_cards = @main_cards.where(card_id: [card_ids]) %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment