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

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -