# global back link

**URL:** <https://discuss.rubyonrails.org/t/global-back-link/26838>\
**Category:** rubyonrails-talk\
**Created:** [March 25, 2008, 5:05pm UTC](https://discuss.rubyonrails.org/t/global-back-link/26838 "2008-03-25T17:05:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomi](https://avatars.discourse-cdn.com/v4/letter/t/f4b2a3/32.png) [@Tomi](https://discuss.rubyonrails.org/u/Tomi)\
**Post date:** [March 25, 2008, 5:05pm UTC](https://discuss.rubyonrails.org/t/global-back-link/26838/1 "2008-03-25T17:05:35Z")

</div>

One thing I've encountered a lot within application development is the need for a global "back link". Yes, I know you can use javascript, but I am looking for a more elegant approach.... accomplished using the rails framework. The scenario is... I can arrive at the same page from various origins within my application. But I would like to be able to easily redirect the user back the exact page they came from ... or if an "edit/update" occurred, I could perform the save and return the user back appropriately. Has anyone seen/implemented such a solution before??

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [March 25, 2008, 5:28pm UTC](https://discuss.rubyonrails.org/t/global-back-link/26838/2 "2008-03-25T17:28:48Z")

</div>

> One thing I've encountered a lot within application development is the need for a global "back link". Yes, I know you can use javascript, but I am looking for a more elegant approach.... accomplished using the rails framework. The scenario is... I can arrive at the same page from various origins within my application. But I would like to be able to easily redirect the user back the exact page they came from ... or if an "edit/update" occurred, I could perform the save and return the user back appropriately. Has anyone seen/implemented such a solution before??

Well there's redirect\_to :back (but if the referrer isn't set that  
won't work)

Fred

---

<div class="post-metadata">

**Author:** ![Tomi](https://avatars.discourse-cdn.com/v4/letter/t/f4b2a3/32.png) [@Tomi](https://discuss.rubyonrails.org/u/Tomi)\
**Post date:** [March 25, 2008, 8:56pm UTC](https://discuss.rubyonrails.org/t/global-back-link/26838/3 "2008-03-25T20:56:42Z")

</div>

Thanks, Fred. That will work for 90% of what I need. The other 10% comes from the need to know where the "new/edit" requests came from (list page, etc).
