# Link\_to current page

**URL:** <https://www.ruby-forum.com/t/link-to-current-page/175147>\
**Category:** Rails\
**Created:** [September 9, 2009, 12:13am UTC](https://www.ruby-forum.com/t/link-to-current-page/175147 "2009-09-09T00:13:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![glex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f07891/32.png) [@glex](https://www.ruby-forum.com/u/glex)\
**Post date:** [September 9, 2009, 12:13am UTC](https://www.ruby-forum.com/t/link-to-current-page/175147/1 "2009-09-09T00:13:58Z")

</div>

I have a desktop version and a mobile version of my website.  
They have different views, and the one to use is determined  
automatically from the user agent string.

However, I want to let the user switch from/to mobile version manually  
by providing a link to \<current\_page\>?view\_format=mobile

How can I do it? Can a link\_to helper method do it? If yes, then how?

Thanks,

Gleb

---

<div class="post-metadata">

**Author:** ![glex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f07891/32.png) [@glex](https://www.ruby-forum.com/u/glex)\
**Post date:** [September 9, 2009, 7:11am UTC](https://www.ruby-forum.com/t/link-to-current-page/175147/2 "2009-09-09T07:11:23Z")

</div>

\<%= link\_to “Mobile”, :action =\> “action\_name”, :view\_format =\> “mobile”  
%\>

# if action\_name is name of your current action

## Thanks, Abhinav

à¤…à¤­à¤¿à¤¨à¤µ  
[http://twitter.com/abhinav](http://twitter.com/abhinav)

On Wed, Sep 9, 2009 at 3:43 AM, Gleb M. \<
