Hi,
A question that I have been thinking about is.. by the time the
initialize method is called, has the instance of the object already been
created?
I''ve been thinking of creating a class object that would only have one
given instance based on a given attribute (ie: a "Town" object,
whereby
only 1 town can exist in the entire table with a particular postal code)
but to simplify things, I don''t wish to have the need to have to check
for the existence of this object prior to invoking the constructor. What
I''m trying to do is to make it such that if the object already exists,
the existing one will be returned back to the caller instead.
I hope I have not been making it sound too complicated :)
Is it doable by simply assigning "self" to the existing value in the
initialize method for existing records?
Thanks.
--
Posted via http://www.ruby-forum.com/.