This line of code:
@instance.attributes.each{|key, value| @instance.send(key) = nil}
yields this error:
syntax error, unexpected '=', expecting '}'
I'm having trouble understanding why that is.. When I write something like:
@instance.attributes.each{|key, value| puts @instance.send(key)}
it behaves as expected, outputting the value of each attribute. Why does it work as a getter but not as a setter in this context? Is there a problem with my syntax?
Thanks a lot.
@instanceis anActiveRecordinstance, you could use@instance[key] = nil, seeActiveRecord::AttributeMethods#[]=