Passing parameter to new object

0 views
Skip to first unread message

Phil Rhoades

unread,
May 10, 2008, 3:04:11 PM5/10/08
to rubyonra...@googlegroups.com
People,

I have tables "tickets" and "notes" - tickets has_many notes.

I have added:

<td><%= link_to 'Add note', new_note_path %></td>

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 Rhoades

Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney NSW 2001
Australia
E-mail: ph...@pricom.com.au

Karthi kn

unread,
May 12, 2008, 4:29:31 AM5/12/08
to rubyonra...@googlegroups.com
Try with,

<td><%= link_to 'Add note', new_note_path(:ticket_id => ticket.id)
%></td>

or

<td><%= link_to 'Add note', new_note_path+"?ticket_id=#{ticket.id}"
%></td>
--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages