I need some help with redirect_to_url

Is there any way to do a “redirect_to_url” back into a “div” element?
For example, I have 2 div elements in the same .rhtml file.

 <div id="map"></div>

 <div id="article"></div>

When someone tries to add a new article the control checks to see if
they are logged in. If they are not it saves the last location (the new
article form)and redirects them to a login page. Once they logged in
they get redirected back to a new article form, not inside the article
div. How can I have the article redirected to the article div?

Here is what the code looks like:

view map_article.rhtml:

#display map
 #display list of articles
 <div id="article"></div>

When someone clicks on the new link.

def new
require_auth ‘users’
@article = Article.new

the require_auth function:

def require_auth(credentials)
#store previous location
cookies[:return_to] = {:value => @request.request_uri, :expires =>
nil }

#go to login controller


login controller:

def login
#when user login they come back to this login def
if cookies[:return_to].nil?
redirect_to default
redirect_to_url cookies[:return_to]
cookies[:return_to] = nil

The redirect_to_url does not go back to the map_article.rhtml article
div but it goes back to the url that list the new article form. How can
I get the new article form to go back to the map_article.rhtml article
div? Thank you.

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