title: ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'user_id' in 'field list' ruby fixtures
body: <p>I try to run the test but it fails as below.</p>
  
  <pre><code>[user1 project]$  rake test
  DEPRECATION WARNING: String based terminators are deprecated, please use a lambda. (called from included at /home/.gem/ruby/2.1.3/bundler/gems/authlogic-09163c7d2a9b/lib/authlogic/session/callbacks.rb:66)
  DEPRECATION WARNING: String based terminators are deprecated, please use a lambda. (called from included at /home/.gem/ruby/2.1.3/bundler/gems/authlogic-09163c7d2a9b/lib/authlogic/session/callbacks.rb:67)
  Started
  
  ERROR["test_login_and_access_bookmarks/managing_bookmarks", BookmarksTest, 0.120519093]
   test_login_and_access_bookmarks/managing_bookmarks#BookmarksTest (0.12s)
  ActiveRecord::StatementInvalid:         ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'user_id' in 'field list': INSERT INTO `roles` (`id`, `user_id`, `created_at`, `updated_at`) VALUES (4, 2, '2015-03-15 17:54:24', '2015-03-15 17:54:24')
  
  
    1/1: [=========================================================================================================] 100% Time: 00:00:00, Time: 00:00:00
  
  Finished in 0.12271s
  1 tests, 0 assertions, 0 failures, 1 errors, 0 skips
  [user1 project]$  
  </code></pre>
  
  <p>I have two tables users and roles and two fixtures named <code>users.yml</code> and <code>roles.yml</code>. </p>
  
  <p>Content of users.yml :</p>
  
  <pre><code># Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
  
  
  user2:
    name: user2
    id: 2
  </code></pre>
  
  <p>Contents of roles.yml:</p>
  
  <pre><code>user2_1:
    id: 4
    user_id: 2
  </code></pre>
  
  <p>What could be the problem here? I am trying to link the users table with roles establishing a relationship such that - user2 from users table has role id 4 in roles table. Would appreciate any help/advice. Thanks!</p>
  
  <p>I checked some stackoverflow posts like this- <a href="https://stackoverflow.com/questions/11727199/activerecordstatementinvalid-mysql2error-unknown-column">ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column</a> but did not find a working answer.</p>
  
  <p>Structure of roles table:</p>
  
  <pre><code>mysql&gt; describe roles
      -&gt; ;
  +-----------------+--------------
  | Field           | Type         
  +-----------------+--------------
  | id              | int(11)      
  | name            | varchar(255) 
  | parent_id       | int(11)      
  | description     | varchar(255) 
  | default_page_id | int(11)      
  | cache           | text         
  | created_at      | datetime     
  | updated_at      | datetime     
  +-----------------+--------------
  </code></pre>