title: Ruby on Rails - How to replace one has_one association with another without :delete or :destroy
body: <p>I have these two classes:</p>
  
  <pre><code>    class Dungeon &lt; ApplicationRecord
        has_one :room
        ...
      end
  
      class Room &lt; ApplicationRecord
        belongs_to :dungeon
        ...
      end
  </code></pre>
  
  <p>I want to be able to replace Dungeon's one Room object with another without actually deleting or destroying Dungeon's original Room object. When I try using <code>update(room: r)</code>, I get </p>
  
  <pre><code>ActiveRecord::RecordNotSaved: Failed to remove the existing associated room. The record failed to save after its foreign key was set to nil.
  </code></pre>
  
  <p>What do I need to do to be able to simply replace Dungeon's one room with another?</p>