app/models/section.rb
#remove loop_items from a set of items that are not available for a given user
remove loop_items from a set of items that are not available for a given user
remove loop_items from a set of items that are not available for a given user
def remove_unavailable items, user
    aux = Array(items)
    items.each do |item|
      if !self.available_for? user, item
        aux.delete(item)
      end
    end
    aux
  end
def remove_unavailable items , user aux = Array ( items ) items . each do | item | if ! self . available_for? user , item aux . delete ( item ) end end aux end
remove loop_items from a set of items that are not available for a given user
remove loop_items from a set of items that are not available for a given user
items
user