Can't log into Active Admin. Any way to create an admin user?

activeadmin, ruby, ruby-on-rails

Solution

You can run a `rails console` on your development server, and create a new admin user in the console itself.

The following is a typical sequence of such commands (change them according to your setup):

user = AdminUser.new
user.email = "<your email>"
user.password = "<your password>"
user.save

That will create the required admin for you. :)

Problem

When I try to log in with the default admin user, I get "invalid email or password." Is there a way to create a user with code and try to log in that way? I can log in on my live website, but not locally. My development code matches exactly what is on production.

Original source