I use the following code to redirect them to the page they requested before
they logged in.  Maybe this will get you on the right path.  I put it in the
controller under protected.

# Protect a page from unauthorized access.
  def protect
    unless logged_in?
      session[:protected_page] = request.request_uri
      flash[:notice] = "Please log in first"
      redirect_to :action => "login"
      return false
    end
  end

  # Redirect to the previously requested URL (if present).
  def redirect_to_forwarding_url
    if (redirect_url = session[:protected_page])
      session[:protected_page] = nil
      redirect_to redirect_url
    else
      redirect_to :action => "index"
    end
  end


Sean McGilvray & Sarena Byers
Executive Director
Identity Theft Specialist
Pre-Paid Legal Service's, Inc. NYSE:PPD
Phone:  760-486-1019
[EMAIL PROTECTED]
http://www.transferhome.net


On Wed, Nov 26, 2008 at 8:32 AM, elioncho <[EMAIL PROTECTED]> wrote:

>
> I have a friendship system where users can create new friendships from
> different views. The idea is to redirect them to where they initially
> requested, accepted, etc... the friendship. To do this, I need to
> store the URL path from where they are sending the request. Is there a
> way to save the initial URL (from where the request mas made to the
> friendships controller). Any light on this?
>
> Thanks for your time,
>
> ElĂ­as
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to