<p>There are multiple different contexts here which are getting confused...</p>
<p>In the controller tests thing like <code>get</code> take two hashes - the first is arguments and I am surprised any conversion happens there although it seems that is must be converting objects to IDs implicitly. I would prefer not to do that though an ID is what is expected there and what would be passed in a real URL based call.</p>
<p>The second is the session hash, and we store a user ID in our session hash under the <code>:user</code> key so again I am tempted to say we should be explicit about that (ie the opposite of this change) and not rely on rails to do some magic conversion.</p>
<p>In the actual rails code you can for example do <code>:user => user</code> which matches on the association or <code>:user_id => user.id</code> which matches on the actual attribute (field) and apparently you can also do <code>:user => user.id</code> and rails magically fixes it but again my preference would be not to rely on that.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/1456#issuecomment-281635961">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABWnLeS9E87bxxTIdwji7RsM9mcvioMaks5rfBPsgaJpZM4MIbm_">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABWnLWmJO8Lr9W7l1Kj836U-UU3e88Viks5rfBPsgaJpZM4MIbm_.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/openstreetmap/openstreetmap-website/pull/1456#issuecomment-281635961"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/openstreetmap-website","title":"openstreetmap/openstreetmap-website","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/openstreetmap-website"}},"updates":{"snippets":[{"icon":"PERSON","message":"@tomhughes in #1456: There are multiple different contexts here which are getting confused...\r\n\r\nIn the controller tests thing like `get` take two hashes - the first is arguments and I am surprised any conversion happens there although it seems that is must be converting objects to IDs implicitly. I would prefer not to do that though an ID is what is expected there and what would be passed in a real URL based call.\r\n\r\nThe second is the session hash, and we store a user ID in our session hash under the `:user` key so again I am tempted to say we should be explicit about that (ie the opposite of this change) and not rely on rails to do some magic conversion.\r\n\r\nIn the actual rails code you can for example do `:user =\u003e user` which matches on the association or `:user_id =\u003e user.id` which matches on the actual attribute (field) and apparently you can also do `:user =\u003e user.id` and rails magically fixes it but again my preference would be not to rely on that."}],"action":{"name":"View Pull Request","url":"https://github.com/openstreetmap/openstreetmap-website/pull/1456#issuecomment-281635961"}}}</script>