Passing parameter to new object

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: [email protected]

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}" %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs