<p dir="auto">This switches the logic so that <code>belongs_to</code> parent objects must exist by default, and marks the optional ones explicitly. This is reflected in the null/not_null status on the relevant db columns.</p>
<p dir="auto">Doing this exposed a small corner case where we were relying on the previous default (of everything being optional) in order for trace objects to pass validation. When the <code>belongs_to</code> was made required by default, rails couldn't autodetect the inverse relationship, and so thought that all tracetags for new traces were invalid. Adding inverse_of fixed this. See also <a href="https://guides.rubyonrails.org/association_basics.html#bi-directional-associations" rel="nofollow">https://guides.rubyonrails.org/association_basics.html#bi-directional-associations</a> for a better explanation.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/3470'>https://github.com/openstreetmap/openstreetmap-website/pull/3470</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/commits/3cf3b3ce4e9551d532fee3b26c1f0a708cf53388" class="commit-link">3cf3b3c</a>  Specify inverse_of for trace tags and points</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/commits/a1fab856e3f4c4659761aeb48b37230d9b5cc289" class="commit-link">a1fab85</a>  Enable active_record.belongs_to_required_by_default</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files">11 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-428acb6c9bafa225cc8dfc426142534aa102be5d4291707ee2d43f528b7bea1e">app/models/access_token.rb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-2ca3a978e5b6e4fee47713d116f75573a7768194f4b0f111deadd08f7a23dc04">app/models/client_application.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-cd75dd8ea34b8e05a215a3f3f8eb0627a26357293ffe415244f30d7a7b7c60e3">app/models/issue.rb</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-0858cfa3782c0bba33f9908f6588bfebc08fd0af5a423b77bb5f4d35969f91b6">app/models/note_comment.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-4a4e54eec60e3324b16652796e58be94424789ecd652cbe81da5ac72689f9f24">app/models/oauth_token.rb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-4c50108aa94328d5d91f43621940bf6ddc6e71541957230e73bd67984a149f02">app/models/old_node.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-5db6f2fd2ae37c6c561b35eb05d1b8cc8269f2be66904f04456350839ce76a4a">app/models/old_relation.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-f5c22ac10c6752867ac4b5758139cac9801401c0d514fa597cfbaa08e099b0c3">app/models/old_way.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-49ff8e13eb2bff9ffd834dad7421f568b40186cb58b28e7eac6b3e9168ec8759">app/models/trace.rb</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-87e8b3e2fbf2b8ad40f3ad15d15af53f2cef9deb2134d983dd3565982cfe8249">app/models/user_block.rb</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470/files#diff-c1fd91cb1911a0512578b99f657554526f3e1421decdb9e908712beab57e10f9">config/application.rb</a>
    (4)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/3470.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/3470.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/3470.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/3470.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3470">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLLQNVEIBZGKSP3MD4LU4T45DANCNFSM5PEWSC7A">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLP2ZAVWPZMYFXNYYZ3U4T45DA5CNFSM5PEWSC7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4RDQ3FPQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/3470</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/3470",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/3470",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>