I am installing the devise gem for authentication in a Ruby on Rails application and I ran the database migration like this:
rake db:migrate
and got this error:
undefined method `reference' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x9322248>
This is a bit cryptic. Where should I go to debug this and what could the problem be?
The only non-standard thing I did was give it the table name "users" which is my table name in this previous command: rails generate devise users
Also, my routes.rb file has this new entry:
devise_for :users
Probably the issue is mis-matched columns in my database and what the auth package thinks the users table should be like. Where do I look to see what the auth package thinks the columns are like? And where do I find where the create-table command is for the users table that I have. It was made with the scaffold command originally which put a whole bunch of extra and useless things in my system.
My db/migrate/users/create_users file looks like this:
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.timestamps
end
end
def self.down
drop_table :users
end
end
Which is basic, but my users table in the db has these columns:
+------------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+------------------+------+-----+---------+-------+
| uid | int(10) unsigned | NO | PRI | 0 | |
| name | varchar(60) | NO | UNI | | |
| pass | varchar(128) | NO | | | |
| mail | varchar(254) | YES | MUL | | |
| theme | varchar(255) | NO | | | |
| signature | varchar(255) | NO | | | |
| signature_format | varchar(255) | YES | | NULL | |
| created | int(11) | NO | MUL | 0 | |
| access | int(11) | NO | MUL | 0 | |
| login | int(11) | NO | | 0 | |
| status | tinyint(4) | NO | | 0 | |
| timezone | varchar(32) | YES | | NULL | |
| language | varchar(12) | NO | | | |
| picture | int(11) | NO | | 0 | |
| init | varchar(254) | YES | | | |
| data | longblob | YES | | NULL | |
+------------------+------------------+------+-----+---------+-------+
And I am not sure how such an inconsistency can exist after I run the migrate command. Where does it take instructions from if not the above file I posted?
Thanks!