# Appending parameters to a link

**URL:** <https://www.ruby-forum.com/t/appending-parameters-to-a-link/183588>\
**Category:** Rails\
**Created:** [February 17, 2010, 1:19am UTC](https://www.ruby-forum.com/t/appending-parameters-to-a-link/183588 "2010-02-17T01:19:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [February 17, 2010, 1:19am UTC](https://www.ruby-forum.com/t/appending-parameters-to-a-link/183588/1 "2010-02-17T01:19:21Z")

</div>

Consider

link = url\_for(:controller =\> “signed\_in”,  
:action =\> “show”, :id =\> “user\_info”)

# =\> /signed\_in/user\_info

to which I wish to add the either or both of the following

locale=en  
nickname=ralph

Is there a nice way in Rails or Ruby to do this so that I end up with  
/signed\_in/user\_info?locale=en&nickname=ralph  
or  
/signed\_in/user\_info?locale=en  
or  
/signed\_in/user\_info?nickname=ralph  
but not  
/signed\_in/user\_info?locale=en?nickname=ralph  
?

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [February 17, 2010, 1:30am UTC](https://www.ruby-forum.com/t/appending-parameters-to-a-link/183588/2 "2010-02-17T01:30:03Z")

</div>

> Is there a nice way in Rails or Ruby to do this so that I end up with  
> /signed\_in/user\_info?locale=en&nickname=ralph  
> or  
> /signed\_in/user\_info?locale=en  
> or  
> /signed\_in/user\_info?nickname=ralph  
> but not  
> /signed\_in/user\_info?locale=en?nickname=ralph  
> ?

link = url\_for(:controller =\> “signed\_in”,  
:action =\> “show”, :id =\> “user\_info”  
:locale =\> “en”, :nickname =\> “ralph”)

-philip

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [February 17, 2010, 10:33am UTC](https://www.ruby-forum.com/t/appending-parameters-to-a-link/183588/3 "2010-02-17T10:33:45Z")

</div>

On 17 February 2010 00:28, Philip H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> link = url\_for(:controller =\> “signed\_in”,  
> :action =\> “show”, :id =\> “user\_info”

There should be a comma on the end of line above of course.

Colin
