Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding New Admins to Active Admin

I am using devise for my users. I recently installed the rails Active Admin gem, everything is working beautifully.

However I can't figure out how to add a new admin users. I can see that active admin created an admin_user table in the db with a user [email protected], which I use to log in to the interface.

I tried adding admin_user as a resource so that I can just click the Add Admin User button within the active admin interface to add a new user, however that does not seem to work.

like image 381
alik Avatar asked Sep 28 '11 22:09

alik


People also ask

What is Activeadmin in rails?

Active Admin is a Ruby on Rails plugin for generating administration style interfaces. It abstracts common business application patterns to make it simple for developers to implement beautiful and elegant interfaces with very little effort.


2 Answers

What brian said works perfectly http://net.tutsplus.com/tutorials/ruby/create-beautiful-administration-interfaces-with-active-admin/

AdminUser.create!(:email => '[email protected]', :password => 'password', :password_confirmation => 'password') 
like image 50
Scott Avatar answered Oct 11 '22 05:10

Scott


What Brian said works, but if you want to set the password in the interface rather than have it send a reset email try this:

Leave the admin_user model at its original generated default, then in app/admin/admin_users.rb:

ActiveAdmin.register AdminUser do   index do     column :email     column :current_sign_in_at     column :last_sign_in_at     column :sign_in_count     default_actions   end    form do |f|     f.inputs "Admin Details" do       f.input :email       f.input :password       f.input :password_confirmation     end     f.buttons   end end 
like image 27
Nate914375 Avatar answered Oct 11 '22 05:10

Nate914375