undefined method `database_authenticatable' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x9dee690>

心不动则不痛 提交于 2019-11-30 08:01:57

I just had what I think is the same issue, I updated my gem, and dropped my db, later I got a very similar message, then I created a new rails app just to compare and it turns out the migration file has been changed, now it includes the columns instead of calling methods.

I hope it helps.

Cheers!

I also ran into this issue on my existing app as I tried to deploy to a new staging server.

Ended up being that the Devise gem had been updated to 2.1 and I hadn't fixed the migration to work correctly with the new version.

Be sure to read through their migration to 2.1 doc on their wiki -- https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.1

Also, be sure to read through the doc for how to correctly adjust existing migrations -- https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0-migration-schema-style

I've run into this twice and there is a really easy solution - instead of db migrations, run this:

heroku run rake db:create 
# optionally with --app your_apps_name if you have multiple apps.

then:

rake db:schema:load

I think the problem might be as result of changes in Devise 2.0 migration schema style. Check out new schema format on the link below. Update migration accordingly and try again. This worked for me especially with #heroku

https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0-migration-schema-style

New to this site as you can see from my rep. John Kamuchau is correct, you need to change the xxxx_devise_create_users.rb migration according to your version.

For example I just updated a rails 3.2 to 4.2 updating devise accordingly and I had to change out the deprecated -

t.database_authenticatable :null => false

for -

## Database authenticatable
t.string :email,              null: false, default: ""
t.string :encrypted_password, null: false, default: ""

Old question but hope this helps if someone comes looking.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!