Consider this as a challenge rather than its general approach. The reason I mention this is because, it is generally preferred to incorporate admin-accessible features into the public facing site. This is what’s required:
- Devise model for Users, visitors accessing the public facing site
- Devise model for Admins
- Namespace or scope the admin ‘area’ to
/admin. Admins can only login from this route. - Users can sign up directly from the site’s public facing landing page; they are not forced to visit
/users/sign_upas per the default devise generated route. - Consider overriding the default devise controllers
Thanks,
Mike.
The following seems like I’ve made some progress in the right direction; this at least provides identical out-of-the-box devise functionality for both users and admins, with the custom routing,
Ideas?
caveat: in this example, I’ve included the :registerable devise module in the Admin model just for testing during development. The
sign_uproute will, ultimately, be removed.Much searching yielded (mind the pun) the following blog post that seems to indicate overriding a devise controller requires the re-mapping of all its specified ‘HTTP verbs’ as it were; this makes sense as unmapped ones would be handled by the default devise controller.
If anyone has more experience working with multiple devise models and the separated admin approach, I would be very much interested in your thoughts and suggestions!