title: Rails, SQLException: no such column
body: <p>After rechecking the code, restarting my computer, and running rake db:migrate, I'm not sure what else to do with this. I keep getting the following error:</p>
  
  <pre><code>SQLite3::SQLException: no such column: uploads.user_id: SELECT COUNT(*) FROM "uploads"  WHERE "uploads"."user_id" = 1
  
  Extracted source (around line #12):
  
  9:     &lt;/section&gt;
  10:   &lt;/aside&gt;
  11:   &lt;div class="span8"&gt;
  12:     &lt;% if @user.uploads.any? %&gt;
  13:       &lt;h3&gt;Uploads (&lt;%= @user.uploads.count %&gt;)&lt;/h3&gt;
  14:       &lt;ol class="uploads"&gt;
  15:         &lt;%= render @uploads %&gt;
  </code></pre>
  
  <p>Does this have anything to do with the has_many association?</p>
  
  <p><strong>show.html.erb</strong></p>
  
  <pre><code>&lt;% provide(:title, @user.name) %&gt;
  &lt;div class="row"&gt;
  &lt;aside class="span4"&gt;
  &lt;section&gt;
    &lt;h1&gt;
      &lt;%= gravatar_for @user %&gt;
      &lt;%= @user.name %&gt;
    &lt;/h1&gt;
  &lt;/section&gt;
  &lt;/aside&gt;
  &lt;div class="span8"&gt;
  &lt;% if @user.uploads.any? %&gt;
    &lt;h3&gt;Uploads (&lt;%= @user.uploads.count %&gt;)&lt;/h3&gt;
    &lt;ol class="uploads"&gt;
      &lt;%= render @uploads %&gt;
    &lt;/ol&gt;
    &lt;%= will_paginate @uploads %&gt;
  &lt;% end %&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>upload.rb</strong></p>
  
  <pre><code>class Upload &lt; ActiveRecord::Base
  attr_accessible :title
  
  belongs_to :user
  
  validates :title, presence: true
  validates :user_id, presence: true
  
  default_scope order: 'uploads.created_at DESC'
  end
  </code></pre>
  
  <p><strong>user.rb</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  attr_accessible :name, :email, :password, :password_confirmation
  has_secure_password
  has_many :uploads, dependent: :destroy
  
  before_save { |user| user.email = email.downcase }
  before_save :create_remember_token
  
  validates :name, presence: true, length: { maximum: 50 }
  VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
  validates :email, presence:   true,
                  format:     { with: VALID_EMAIL_REGEX },
                  uniqueness: { case_sensitive: false }
  validates :password, length: { minimum: 6 }
  validates :password_confirmation, presence: true
  
  private
  
  def create_remember_token
    self.remember_token = SecureRandom.urlsafe_base64
  end
  end
  </code></pre>
  
  <p><strong>from users_controller.rb</strong></p>
  
  <pre><code>  def show
    @user = User.find(params[:id])
    @uploads = @user.uploads.paginate(page: params[:page])
    end
  </code></pre>
  
  <p><strong>20120524145724_create_uploads.rb</strong></p>
  
  <pre><code>class CreateUploads &lt; ActiveRecord::Migration
  def self.up
  create_table :uploads do |t|
    t.string :title
    t.integer :user_id
  
    t.timestamps
    end
    add_index :uploads, [:user_id, :created_at]
  end
  
  def self.down
  drop_table :uploads
  end
  end
  </code></pre>