I have method in my model that returns an array called all_items
I'm trying to filter out the insurance item if the duration is more than 365 days so as below:
def available_items
return all_items - [all_items.insurance] if duration >= 365
all_items
end
But I'm still getting insurance even if the duration is more than 365. Tested it in the console and insurance comes up as part of the array. What did I do wrong here?