title: Why do I get ActionView::Template::Error: undefined method `isebook' for nil:NilClass on Heroku but not locally
body: <p>I have a Rails 4 app running SQLite locally and PostgreSQL on Heroku.</p>
  
  <p>I have a products class, which has a boolean column "isebook" that is set to either true or false in a form on products/new.html.erb.</p>
  
  <pre><code>&lt;%= form_for(@product, :html =&gt; {:multipart =&gt; true}) do |f| %&gt;
        &lt;% if @product.errors.any? %&gt;
          &lt;div class="alert alert-danger alert-dismissable"&gt;
              &lt;button type="button" class="close" data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
  
            &lt;h3&gt;&lt;%= pluralize(@product.errors.count, "error") %&gt; prohibited this product from being saved:&lt;/h3&gt;
  
            &lt;ul&gt;
            &lt;% @product.errors.full_messages.each do |msg| %&gt;
              &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;
            &lt;% end %&gt;
            &lt;/ul&gt;
          &lt;/div&gt;
        &lt;% end %&gt;
  
        &lt;div class="form-group"&gt;
          &lt;%= f.label :name %&gt;&lt;br&gt;
          &lt;%= f.text_field :name, class: "form-control"  %&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;%= f.label :link %&gt;&lt;br&gt;
          &lt;%= f.text_field :link, class: "form-control"  %&gt;
          &lt;p style="font-size:12px; margin-top:2px;"&gt;&lt;i&gt;(Begin link with http:// or https://)&lt;/i&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;%= f.label :description %&gt;&lt;br&gt;
          &lt;%= f.text_area :description, class: "form-control"  %&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;%= f.label "Product is an Ebook?" %&gt; &lt;br /&gt;
          &lt;%= f.check_box :isebook %&gt; &lt;br /&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;%= f.label :image, 'Product Image'  %&gt;&lt;br&gt;
          &lt;%= f.file_field :image, class: "form-control"  %&gt;
  
        &lt;/div&gt;
        &lt;div class="actions"&gt;
          &lt;%= f.submit "Create Product", class: "btn btn-primary"  %&gt;
        &lt;/div&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>In the controller, this field is being required:</p>
  
  <pre><code>def product_params
    params.require(:product).permit(:name, :description, :isebook, :image)
  end
  </code></pre>
  
  <p>The entire code for the controller method:</p>
  
  <pre><code>def new
  
  # Only make new product if user has remaining products
  
  @product = Product.new
  
  if current_user.prodused &lt; current_user.prodlimit
    respond_with(@product)
  else
    redirect_to user_path(current_user.id), error: "You've reached your product limit. Upgrade your account to add more products."
  end
  
  end
  </code></pre>
  
  <p>This is the product model:</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
  
   validates :name, :description, presence:true
   validates :link, :format =&gt; URI::regexp(%w(http https))
  
   belongs_to :user
  
   has_attached_file :image, :styles =&gt; {:medium =&gt; "300x300", :thumb =&gt; "200x200"}, :default_url =&gt; "/images/:style/missing.jpg"
  
  end
  </code></pre>
  
  <p>This works correctly locally, when a new product is created the isebook field is assigned true or false based on if the checkbox is selected or not.</p>
  
  <p>I'm now attempting to test on Heroku, I cleared the entire production database and ran all the migration files to clear all existing products. I then created an account successfully, when attempting to render products/new.html.erb I get the error <strong>ActionView::Template::Error: undefined method `isebook' for nil:NilClas</strong></p>