Hi! How to use this? I can declare it only inside a controller, so i tried to do add this to application controller: def back redirect_to :back end so i could call in all my views link_to 'back', :controller => 'application', :action => 'back' but it doesn't work - there are no errors, but i'm still on the same page.
on 2006-03-09 10:23
on 2006-03-09 10:32
it has to be used in the controller... On Thursday, March 09, 2006, at 10:23 AM, szymek wrote: >link_to 'back', :controller => 'application', :action => 'back' > >but it doesn't work - there are no errors, but i'm still on the same >page. > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails Mikkel Bruun www.strongside.dk - Football Portal(DK) nflfeed.helenius.org - Football News(DK) ting.minline.dk - Buy Old Stuff!(DK)
on 2006-03-09 10:35
It does work -- except that when you click on that link, you go from your current page to the 'back' action, which will redirect you back to the current page. Why? Because your current page will effectively be the referrer URL! What you need is a helper called link_to_back or so, which will return the value of link_to request referrer. I actually have found it nice to have link_to_back to take in a :default option because you may not always have a referring page.
on 2006-03-09 11:31