Toby Hede
Toby Hede

Reputation: 37143

active admin & devise with user registration

Attempting/struggling to get registration and sign-up working within an active admin project.

I have added the devise "registerable" to my admin_user model:

devise :database_authenticatable, :registerable, :confirmable

I can see a sign-up form, but this form does submits via GET to the dashboard path (/admin) and doesn't actually do anything.

Is there a trick to getting this hooked up?

Upvotes: 2

Views: 3291

Answers (1)

Siwei
Siwei

Reputation: 21567

Just keep in mind that :

  • Devise is an authentication framework so it is in charge of "register", "authenticate", "login/out"
  • ActiveAdmin is a tool to generate resource management.
  • Personally I don't like the way that ActiveAdmin uses its own devise config file. ( the routes it generated will mass up your own routes.rb file)

So, I think you should consider your "register" function isolated from your "ActiveAdmin". I mean, when you are implementing the "register", just do it with "Devise", it doesn't have any relationship with "ActiveAdmin". :-)

OK. short answer:

1. rails generate devise:views
# or : copy the files from devise gem folder into your own Rails application.
2. customize your view page, and make sure your routes.rb:
   # not devise_for :admin_users, ActiveAdmin::Devise.config  .
   devise_for :admin_users  

Upvotes: 2

Related Questions