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.
<head>
</head>
<body>
<div id="map"></div>
<div id="article"></div>
</body>
</html>
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:
<head>
</head>
<body>
#display map
<div id="map"></div>
#display list of articles
<div id="article"></div>
</body>
</html>
When someone clicks on the new link.
controller:
def new
require_auth ''users''
@article = Article.new
end
the require_auth function:
def require_auth(credentials)
#store previous location
cookies[:return_to] = {:value => @request.request_uri, :expires =>
nil }
#go to login controller
end
login controller:
def login
#when user login they come back to this login def
.
.
.
if cookies[:return_to].nil?
redirect_to default
else
redirect_to_url cookies[:return_to]
cookies[:return_to] = nil
end
end
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.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---