undefined method `database_authenticatable' for #

后端 未结 5 1457
猫巷女王i
猫巷女王i 2020-12-30 22:17

I am using Active Admin gem for my small application based on Quiz. But when I execute rake db:migrate it gives me error. Following is the trace of the comm

相关标签:
5条回答
  • 2020-12-30 22:24

    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

    0 讨论(0)
  • 2020-12-30 22:26

    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!

    0 讨论(0)
  • 2020-12-30 22:32

    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.

    0 讨论(0)
  • 2020-12-30 22:33

    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

    0 讨论(0)
  • 2020-12-30 22:37

    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
    
    0 讨论(0)
提交回复
热议问题