This is happening because of the way the master
and slave
object is held in memory. Even though you've updated the slave, the master still thinks the slave is associated with it as the associated slave object is still held in memory (this is usually more efficient). When the master is reloaded, the association will disappear. So, if you did this in the console you'd expect to see something like this:
master = Master.find(123)
=> <master object>
master.slave.update_attribute(:master_id, nil)
=> true
master.slave
=> <slave object>
master.reload
OR
master = Master.find(123)
master.slave
=> nil