I have the following function that will do a query for me, the problem I am having (being new to Ruby and RoR) is how to reinitialize the object. Right now it always returns the same value.
class AutoHarnesses < ActiveRecord::Base end def get\_testruns\(io\) agents = AutoHarnesses\.new\(\) io\.puts "What Agent's test runs do you want to see?\\n" io\.print "Agent Name = " my\_agent = io\.gets\.chomp io\.puts "Looking for \#\{my\_agent\}\\n" begin \# I think this is the query I want\.\.\.\. agents = AutoHarnesses\.first\(\) io\.puts %\{Found \#\{agents\.testname\} \- \#\{agents\.status\}\} rescue puts $\! end end
I thought by having a new call at the beginning I could reinitialize the object and clear it out so that I would always get a new one, or if
Well you do create a new instance of AutoHarnesses, but you then overwrite that with the result of AutoHarnesses.first which will always return the same thing.
Frd