Can’t log into Active Admin after pushing to Heroku

问题内容:

I was trying to push a Rails app including active_admin to Heroku.

I expect to be able to log into Active Admin after pushing to Heroku

I have built a Rails app using active_admin. First I tried it on my localhost. I logged in with admin@example.com, set a new admin, and deleted the admin@example.com user. Then I pushed my app to GitHub and further to Heroku. I noticed Active Admin was not reachable on Heroku so I checked the logs and ran heroku rake db:migrate. Now I can switch to the login site at /admin but I cannot login. Neither with the admin@example.com nor my newly-created admin.

How can I fix this?

问题评论:

    
Fixed it with bypassing the authentication in the active_admin.rb
– minennick
yesterday
    
Why would you bypass authentication? How can that possibly be considered a solution?
    
@Chris i set config.current_user_method and config.authentication_method in the active_admin.rb to false. deployed it to heroku. Went in the admin interface and created a new admin. set the methods in the .rb back and deployed it again
– minennick
18 hours ago

答案:

答案1:

When you deploy to Heroku your code gets updated on your dynos. Your database doesn’t. Migrations must be run, e.g. via heroku run rake db:migrate or a release phase command, and any data you want must be created.

Whatever users you’ve configured on your development machine won’t exist on Heroku. This is a good thing.

You should be able to add the default admin user by running heroku run rake db:seed using the Heroku CLI tool. Alternatively, you could run heroku run rails c and create a user interactively.

答案评论:

原文地址:

https://stackoverflow.com/questions/47738847/cant-log-into-active-admin-after-pushing-to-heroku

添加评论

友情链接:蝴蝶教程