I try to run the test but it fails as below.
[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]$
I have two tables users and roles and two fixtures named users.yml
and roles.yml
.
Content of users.yml :
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
user2:
name: user2
id: 2
Contents of roles.yml:
user2_1:
id: 4
user_id: 2
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!
I checked some stackoverflow posts like this- ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column but did not find a working answer.
Structure of roles table:
mysql> describe roles
-> ;
+-----------------+--------------
| 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
+-----------------+--------------