views:

14

answers:

0
Step 1: [setup]
a = Aritcle.new(:some_boolean => false)
a.save
write_to_memcache(a.id, Marshal.dump(a))
b = Marshal.load(read_from_memcache(a.id))

If I do:

b.some_boolean = nil
b.save

the some_boolean is not written back to the DB. DB still remains false.

But:

a.some_boolean = nil
a.save

works perfectly. DB is set to NULL.

Also:

c = Article.find(a.id)
c.some_boolean = nil
c.save

works fine. DB is set to NULL.

I'm not very sure if this is a boolean specific problem, but I'm thinking rails has some private variable to detect if the record is new, and the marshal is screwing it up.

Any hints? This one was a tough nut to crack on production :) Thanks.