Class: Pwb::DeviseController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pwb/devise_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

default_url_options, #set_locale, #set_theme_path

Instance Method Details

#after_sign_in_path_for(_resource_or_scope) ⇒ Object



78
79
80
81
82
# File 'app/controllers/pwb/devise_controller.rb', line 78

def (_resource_or_scope)
  # TODO: - check for admin v standard users
  pwb.admin_path
  # stored_location_for(resource_or_scope) || signed_in_root_path(resource_or_scope)
end

#after_sign_out_path_for(_resource_or_scope) ⇒ Object

Method used by sessions controller to sign out a user. You can overwrite it in your ApplicationController to provide a custom hook for a custom scope. Notice that differently from after_sign_in_path_for this method receives a symbol with the scope, and not the resource.

Overwriting the sign_out redirect path method By default it is the root_path.



70
71
72
73
74
75
76
# File 'app/controllers/pwb/devise_controller.rb', line 70

def after_sign_out_path_for(_resource_or_scope)
  # scope = Devise::Mapping.find_scope!(resource_or_scope)
  # router_name = Devise.mappings[scope].router_name
  # context = router_name ? send(router_name) : self
  # context.respond_to?(:root_path) ? context.root_path : "/"
  pwb.home_path
end