Files

Merb::AuthenticatedHelper

Public Instance Methods

redirect_back_or(default_url, opts = {}) click to toggle source

Add a helper to do the redirect_back_or for you. Also tidies up the session afterwards If there has been a failed login attempt on some page using this method you’ll be redirected back to that page. Otherwise redirect to the default_url

To make sure you’re not redirected back to the login page after a failed then successful login, you can include an ignore url. Basically, if the return url == the ignore url go to the default_url

set the ignore url via an :ignore option in the opts hash.

    # File lib/merb-auth-more/mixins/redirect_back.rb, line 27
27:   def redirect_back_or(default_url, opts = {})
28:     if !session[:return_to].blank? && ![opts[:ignore]].flatten.include?(session[:return_to].first)
29:       redirect session[:return_to].first, opts
30:       session[:return_to] = nil
31:     else
32:       redirect default_url, opts
33:     end
34:     "Redirecting to <a href='#{default_url}'>#{default_url}</a>"
35:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.