Method: Devise::Controllers::Helpers#signed_in_root_path

Defined in:
lib/devise/controllers/helpers.rb

#signed_in_root_path(resource_or_scope) ⇒ Object

The scope root url to be used when they’re signed in. By default, it first tries to find a resource_root_path, otherwise it uses the root_path.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/devise/controllers/helpers.rb', line 171

def signed_in_root_path(resource_or_scope)
  scope = Devise::Mapping.find_scope!(resource_or_scope)
  router_name = Devise.mappings[scope].router_name

  home_path = "#{scope}_root_path"

  context = router_name ? send(router_name) : self

  if context.respond_to?(home_path, true)
    context.send(home_path)
  elsif context.respond_to?(:root_path)
    context.root_path
  elsif respond_to?(:root_path)
    root_path
  else
    "/"
  end
end