How do I iterate over all created yet unsaved objects of a particular class with Ruby? -


i want create multiple instances of class without saving them database. want loop through objects i've created. thoughts?

sounds you're looking objectspace.each_object:

objectspace.each_object(yourclass) |o| # interesting object 'o' here end 

if can manually keep track of objects think better, tend see objectspace last resort.


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -