Rails ActiveAdmin not Working on Heroku but works on Localhost

mayorsanmayor

I installed ActiveAdmin gem on an existing project, and I was able to Login on Localhost and following the documentation everything works perfectly on localhost. But on Heroku I can't login. After running heroku run rake db:seed I can't login with the usual.

Email: [email protected] 
Password: password

I am getting the following error

Invalid Email or password.

Any Idea on how to fix this?

mayorsanmayor

I got it to work. The problem was in the db/seed.rb file. Looks like Heroku removed access for free users to access the console from the terminal. So heroku run rake or rails console didn't work.

Earlier I didn't read the code in the seed file till the end. Here is it:

AdminUser.create!(email: '[email protected]', password: 'password', password_confirmation: 'password') if Rails.env.development?

This means the sample AdminUser created is meant to work only in development environment. It became a production environment the moment it was pushed on heroku. And since I cannot go into the rails console through Heroku. I had to add a new line in the seed file like so:

AdminUser.create!(email: '[email protected]', password: 'SomePassword', password_confirmation: 'SomePassword') 

Now re-push this to heroku. And run heroku run rake db:seed

Now the new AdminUser details will work on your whateveryouwantyoursitetobe.com/admin

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Rails with Devise, works fine on localhost, fails on Heroku

Rails 5 + Heroku: Assets are not loaded in production, but works in localhost

Can not create user with Rails app on heroku, but works perfect on localhost

Websocket working on localhost but not Heroku

Django app works on localhost but not Heroku

Node app working on localhost but not on Heroku?

Rails video and image tag not working in activeadmin

noUiSlider not working on Heroku but works locally

Stripe Payment Works on LocalHost but Does not work on Heroku

Loading dynamic webpage with Puppeteer works on localhost but not Heroku

My worker Celery works in localhost but not in heroku

Chartkick works on localhost but displays "loading" on heroku

CSS and JS are working on localhost, but not on Heroku Webserver

Bootstrap navbar working in online server but not on localhost & heroku

Rails NoMethodError for Blog#create on Heroku, but not Localhost

Rails not porting SQLITE localhost to Heroku PGSQL

Twitter APIs not working on hosting [Works fine on localhost]

Ruby on Rails - Rtesseract not working on Heroku

Highcharts not working on Heroku environment, works on local environment

Rails 4 - App works locally, but not on Heroku

Rails app works locally but not when deployed to Heroku

Rails | Migration missing | Works locally but not on Heroku

Rails 6 omniauth with facebook works locally but not on heroku

Uploading with fog to S3 works from localhost but not with heroku

mongoose post.save failing on heroku, works on localhost

Heroku H10 works on localhost, won't work in deployment

Trix editor isn't working in Heroku, but working fine on localhost

Ruby on Rails database query not working on heroku

Rails 4, Heroku, Bootstrap - Overrides not working in Production