From: Dave Aronson Date: 2011-09-14T07:25:27+09:00 Subject: Re: Using a loop to run similar commands On Tue, Sep 13, 2011 at 11:14, dwight schrute wrote: > Hi again, > > Is there a neater way to do this, by using a loop? > > create1 = agent.get(t1) > create2 = agent.get(t2) ... > create12  = agent.get(t12) To expand a bit on what the others have said: Kudos to you for recognizing that the above was "not neat". Any time you have to append something such as a serial number to differentiate a bunch of data items that are essentially the same, it's a code smell. But don't feel too bad for having done it that way; I saw some actual Rails production code recently at a major company, that had eight weekly timestamps in a class, and then tons of validations on them, not only in relation but individually. And then they used fancy trickery with send in a loop, to address them individually. IMHO they should have been broken out into a separate class.... -Dave -- Main Web Site: davearonson.com | LOOKING FOR WORK, Programming Blog: codosaur.us | preferably RoR, in NoVa/DC; Excellence Blog: dare2xl.com | see main web site.