mercredi 1 juin 2016

How to set multiple parents inside Rails Devise configuration?

By default the devise inherited controllers will have application_controller as parent, and we can change the parent controller to "ApiBaseController" by following way:

# config/initializers/devise.rb
# Now Devise inherited controllers will pass through Api::ApiBaseController
config.parent_controller = 'ApiBaseController'

I need some Devise inherited controllers pass through ApiBaseController, while some other Devise inherited controllers need to pass through PublicBaseController, and few others as ApplicationController, etc. But we can set one parent at a time for one Rails Application by following way.

config.parent_controller = 'ApiBaseController'

Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire