title: Create one-way relationship without foreign key
body: <p>I've got a problem with relationships I'm trying to form between some models.</p>
  
  <p>I have a <strong>Node</strong> which has many <strong>NodeTasks</strong>. This is modelled so that NodeTask <code>belongs_to :node</code>, which works as expected.</p>
  
  <p>I would also like to add a reference to an arbitrary <strong>NodeTask</strong> on <strong>Node</strong> - let's say <code>first_node_task</code>, as an optional attribute. This is where I'm having trouble.</p>
  
  <p>I was able to hack it together so that <code>node.first_node_task</code> could be set and worked as expected with the following migration:</p>
  
  <pre><code>add_reference :nodes, :first_node_task, { type: :uuid, foreign_key: { to_table: :node_tasks } }
  </code></pre>
  
  <p>And model:</p>
  
  <pre><code>class Node
    belongs_to :first_node_task, class_name: 'NodeTask', foreign_key: 'first_node_task_id', optional: true
  end
  </code></pre>
  
  <p>However, I found that I could no longer delete those <strong>Nodes</strong>, because of the reference to <strong>NodeTask</strong>. There was some weird reverse relationship going on with the foreign key constraint: <code>ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR:  update or delete on table "nodes" violates foreign key constraint "fk_rails_696709283b" on table "node_tasks"</code></p>
  
  <p>How can I model my references so that <strong>Node</strong> can have a <code>first_node_task</code> set, which is a reference to an arbitrary <strong>NodeTask</strong>, without affecting the related <strong>NodeTask</strong>?</p>