Method: Devise::FailureApp#scope_url

Defined in:
lib/devise/failure_app.rb

#scope_urlObject (protected)



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/devise/failure_app.rb', line 148

def scope_url
  opts  = {}

  # Initialize script_name with nil to prevent infinite loops in
  # authenticated mounted engines
  opts[:script_name] = nil

  route = route(scope)

  opts[:format] = request_format unless skip_format?

  router_name = Devise.mappings[scope].router_name || Devise.available_router_name
  context = send(router_name)

  if relative_url_root?
    opts[:script_name] = relative_url_root
  end

  if context.respond_to?(route)
    context.send(route, opts)
  elsif respond_to?(:root_url)
    root_url(opts)
  else
    "/"
  end
end