title: Statement invalid while rendering json in Rails
body: <p>for my snippet below for rendering the json</p>
  
  <pre><code>def show
     @product = Product.find(params[:id])
        render json: @product.to_json(:include =&gt; { :items =&gt; { :only =&gt; [:id, 
  :description] }}) 
  end
  </code></pre>
  
  <p>While rendering the json for has many attributes model I am getting invalid statement as follows:</p>
  
  <pre><code>(Mysql2::Error: Unknown column 'items.product_id' in 'where clause': SELECT `items`.* FROM `items` WHERE `items`.`product_id` = 1):
  </code></pre>
  
  <p>While I have a column called products_id for the foreign key instead of product_id. I need to throw statement as products_id without changing the column name in database. </p>