I got a NoMethodError when using a destructive method like filter !.
I've dealt with it, so I'll leave a note. (If you make a mistake, please kindly tell me ...)
def index @object = Object.all @object.filter! do |o| o.id != 1 end end
When I got an object as an array with all, I could use a non-destructive method like filter, but I tried to make an array by playing an object that does not match the conditions with a destructive method like filter !.
However, as the very first heading says, I threw a NoMethodError.
def index @object = Object.all @object.to_a.filter! do |o| o.id != 1 end end
Converting an object to an array with
to_a no longer throws a NoMethodError.
I will add it if I find out the reason.
I will leave a note on it so that I will not forget it. (Reminder)
If there are people who already know the reason and it seems that it is natural, I would be very happy if there is a gentleman who can put a link on something.