bpereira
bpereira

Reputation: 1006

Rails: ActiveAdmin + Devise

Good afternoon. I'm a beginner in Rails and I'm starting this project in college and I need some help. I have users that don't need sign up. I will create all the users. Then, I decided to use the gem ActiveAdmin, and I can add the users through the graphic interface. I thought it would be easy but, after finish the installation, I tried to add some user and I've got a surprise: I have all those fields created by devise to edit. https://i.sstatic.net/yAK1h.png

I wanna know if there is a way that I can edit only the fields created by me, and those other fields automatically fill, like if I'm creating a new user with devise.

P.S: I wanna just lines to follow, not the entire resolution. I'm really lost rs.

Upvotes: 1

Views: 91

Answers (1)

nistvan
nistvan

Reputation: 2960

Yes, you can set which inputs you want to appear in your form:

ActiveAdmin.register AdminUser do

  form do |f|
    f.inputs do
      f.input :email
      f.input :password
    end
    f.actions
  end

end

The rest of the inputs will be filled by Devise.

Docs for ActiveAdmin form: https://github.com/gregbell/active_admin/blob/master/docs/5-forms.md

Upvotes: 2

Related Questions