I need some help with cookies and redirect

Hi - what I basically have is have a webpage where you have a picture.
If you click on the comment button, a comment section will open up on
the same page if you are logged in. If you are not logged in, a login
section will open up on the same page saying to login. Once the user
logs in my webpage should redirect back to the comments section on the
same page with the picture. Instead it’s redirecting to a new page,
showing only the comments and not the picture.

These are the steps my code makes when accesing my webpage:

  1. it render the pictuer page ‘lookat/pictures’
  2. when you click on the comment button the controll checks if you are
    logged in. if you are not it save the last url into a cookie
    ‘cookies[:return_to] = {:value => @request.request_uri, :expires => nil
    }’, which was ‘your/comments’
  3. once you log in it checks to see if there is a url in the cookies and
    then does a ‘redirect_to_url’, the current url is ‘your/comments’ which
    gets render and doesn’t show the picture.

Is there any way to do a redierct back to the picture page with the
comment section showing? If you need code example let me know and I’ll
post it. Thanks in advance.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs