Hi
I am probably missing something, so please help:
I have a table called ''zipped_responses'' with an
''item_names'' varchar column.
I want to create a comma separated string of ''names''.
I have an ''add_item_names'' method which takes a
''name'' and put it at the end
of a string with a preceding comma.
The model goes like this:
class ZippedResponse < ActiveRecord::Base
def add_item_names (name)
str = read_attribute(:item_names)
str << "," unless str.empty?
str << name
write_attribute(:item_names, str)
end
end
Now in the console, I write
z=ZippedResponse.new
z.add_item_names("aa")
and I get:
z.item_names => "aa"
Fine until here. Now I write:
z1=ZippedResponse.new
and to my suprise I get that in z1, the ''item_names'' attribute
has also the
value "aa" !!
(z1.item_name => "aa")
How come ??
Nadav