I have an array and I want to remove some elements. I tried this but it doesn't work:
@restaurants.each_with_index do |restaurant, i|
if (restaurant.stars > 3) @restaurants.slice!(i) end
end
How can I do it?
I have an array and I want to remove some elements. I tried this but it doesn't work:
@restaurants.each_with_index do |restaurant, i|
if (restaurant.stars > 3) @restaurants.slice!(i) end
end
How can I do it?