title: ActiveRecord not finding existing records
body: <p>If I try to create a new 'Refill' record, but I'm getting this error message:</p>
  
  <pre><code>Couldn't find Vehicle with ID=1 for Refill with ID=
  </code></pre>
  
  <p>But if I do a direct select in the SQLite3 database the vehicle record is there. </p>
  
  <p>Here is the relevant code:</p>
  
  <p>vehicle class:</p>
  
  <pre><code>class Vehicle &lt; ApplicationRecord
      has_many :refills, :inverse_of=&gt; :vehicle
      validates_presence_of :prefix, :plate, :diesel_type
  end
  </code></pre>
  
  <p>refill class:</p>
  
  <pre><code>class Refill &lt; ApplicationRecord
      belongs_to :vehicle
      validates_presence_of :date, :mileage, :liters, :vehicle
      accepts_nested_attributes_for :vehicle
  end
  </code></pre>
  
  <p>refill_params method:</p>
  
  <pre><code>def refill_params
    params.require(:refill).permit(:date, :mileage, :liters, vehicle_attributes: [:id])
  end
  </code></pre>
  
  <p>the json I'm trying to POST:</p>
  
  <pre><code>{
      "refill": {
          "date": "2017-01-01",
          "mileage": 125000,
          "liters": 115,
          "vehicle_attributes": {
              "id": 1
          }
      }
  }
  </code></pre>