Update: The preferred method according to the Rails Style Guide is to use self[:name] instead of read_attribute and write_attribute. I would encourage you to skip my answer and instead prefer this one.
You can do it exactly like that, except that you need to use read_attribute to actually fetch the value of the name attribute and avoid the recursive call to the name method: