I have a rails app comprising several engines that are mounted in combinations at a time. There is one engine for B2B side of the app where we have a separate 'User' model(Like a company) for devise authentication. Similarly there is one for end customers which again has its own model for authentication(Like: Users for the company). Similarly, there is another engine for the site admin that is implemented using ActiveAdmin for root level administration.
We might mount one, two or three engines at the same time in several combinations. The problem is that, we have different parent application controllers for each of them and different routers for each of them too. Something like:
devise.rb
-- engine1
config.router_name = :engine1
config.parent_controller = 'Engine1::ApplicationController'
devise.rb
-- engine2
config.router_name = :engine2
config.parent_controller = 'Engine2::ApplicationController'
But, of course, I can't have multiple conflicting config files.
I need help on how I can implement something like this on devise.
You could use cancan gem with devise to manage roles and use multiple models/scopes at a time. Alternatively you can also try mcms authentication. But I would suggest you to also check the canard gem which is highly documented and may help you fill up the blanks faster. Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With