Category
really has no each
method, because it is a model class, not a collection. However, it does have several methods that return objects similar to collections. One of them is all
. Therefore, the code should look like this:
Category.all.each do |test| puts test.inspect end
source share