# Passing parameter to new object

**URL:** <https://www.ruby-forum.com/t/passing-parameter-to-new-object/137256>\
**Category:** Rails\
**Created:** [May 10, 2008, 9:04pm UTC](https://www.ruby-forum.com/t/passing-parameter-to-new-object/137256 "2008-05-10T21:04:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![philippeqc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9bcb4/32.png) [@philippeqc](https://www.ruby-forum.com/u/philippeqc)\
**Post date:** [May 10, 2008, 9:04pm UTC](https://www.ruby-forum.com/t/passing-parameter-to-new-object/137256/1 "2008-05-10T21:04:56Z")

</div>

People,

I have tables “tickets” and “notes” - tickets has\_many notes.

I have added:

 \<%= link\_to 'Add note', new\_note\_path %\>

to:

app/views/tickets/index.html.erb

which works OK but I need to be able to pass the value of ticket.id to  
note.ticket\_id - how do I do that?

Thanks,

## Phil.

Philip R.

Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)  
GPO Box 3411  
Sydney NSW 2001  
Australia  
E-mail: removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![philippeqc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9bcb4/32.png) [@philippeqc](https://www.ruby-forum.com/u/philippeqc)\
**Post date:** [May 12, 2008, 10:29am UTC](https://www.ruby-forum.com/t/passing-parameter-to-new-object/137256/2 "2008-05-12T10:29:31Z")

</div>

Try with,

\<%= link\_to 'Add note', new\_note\_path(:ticket\_id =\> ticket.id) %\>

or

\<%= link\_to 'Add note', new\_note\_path+"?ticket\_id=#{ticket.id}" %\>
