How to get class instances in Ruby?

Viewed 11954

Say I have a class called Post that has many initiated instances (i.e. Post.new(:name => 'foo')).

Is there a way to retrieve all the instances of that class by calling something on it? I'm looking for something along the lines of Post.instances.all

3 Answers
Related