Is there a way to do this in a view? <% redirect_to ''http://url.com'' %> All I can think of is outputting a link and using Javascript to click it, or probably do something like ''doc.location(url)''. csn __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
You could use a meta refresh if it is supposed to be after a set time limit. <meta http-equiv="Refresh" content="4;url=http://www.domain.com/link.html"> On 1/21/06, CSN <cool_screen_name90001@yahoo.com> wrote:> > Is there a way to do this in a view? > > <% redirect_to ''http://url.com'' %> > > All I can think of is outputting a link and using > Javascript to click it, or probably do something like > ''doc.location(url)''. > > csn > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ben Reubenstein http://www.benr75.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060121/d66465f1/attachment.html
Ben Reubenstien wrote:> You could use a meta refresh if it is supposed to be after a set time > limit. > > <meta http-equiv="Refresh" > content="4;url=http://www.domain.com/link.html">Would that work in BODY though? Where I want to redirect is in a template that goes in @content_for_layout in between body tags. csn -- Posted via http://www.ruby-forum.com/.
You can send back some javascript, off the top of my head it would be: <%= javascript_tag ''document.location="http://www.domain.com/link.html";'' %> Cheers, Jonny. csn wrote:> Ben Reubenstien wrote: >> You could use a meta refresh if it is supposed to be after a set time >> limit. >> >> <meta http-equiv="Refresh" >> content="4;url=http://www.domain.com/link.html"> > > Would that work in BODY though? Where I want to redirect is in a > template that goes in @content_for_layout in between body tags. > > csn-- Posted via http://www.ruby-forum.com/.
Why does your controller not have enough information to make this decision, but your view does? This type of work should be kept out of the view code and kept in the controller. That''s what MVC is about, and will help you in the future when your app needs to be maintained. -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of CSN Sent: Saturday, January 21, 2006 1:05 PM To: rails@lists.rubyonrails.org Subject: [Rails] Redirecting in a view? Is there a way to do this in a view? <% redirect_to ''http://url.com'' %> All I can think of is outputting a link and using Javascript to click it, or probably do something like ''doc.location(url)''. csn __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
Tom Fakes wrote:> Why does your controller not have enough information to make this > decision, > but your view does? > > This type of work should be kept out of the view code and kept in the > controller. That''s what MVC is about, and will help you in the future > when > your app needs to be maintained.I agree ;). But it''s just a generic sub template that does one of the following: - links to a file (image, flash) - includes another file (text) - renders a template in a database field - or (hopefully) redirects to another site csn -- Posted via http://www.ruby-forum.com/.
Sounds like its trying to control something. This is a good job for the controller. -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of csn Sent: Saturday, January 21, 2006 6:39 PM To: rails@lists.rubyonrails.org Subject: [Rails] Re: RE: Redirecting in a view? Tom Fakes wrote:> Why does your controller not have enough information to make this > decision, > but your view does? > > This type of work should be kept out of the view code and kept in the > controller. That''s what MVC is about, and will help you in the future > when > your app needs to be maintained.I agree ;). But it''s just a generic sub template that does one of the following: - links to a file (image, flash) - includes another file (text) - renders a template in a database field - or (hopefully) redirects to another site csn -- Posted via http://www.ruby-forum.com/. _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails