I have rails app with models Car
and Wheel
.
And I have the method which returns an array of different objects. e.g.
array = [Car.new, Car.new, Wheel.new, Wheel.new, 'home', 'market', 'fun']
How to count Car
instances and Wheel
instances in an array?
I tried array.include?(Car)
and array.count(Car)
and they didn't work.