RESTful routes: How to pass an additional value to params?!

Hi there,

is it true that with RESTful routes, I can’t pass an additional value to
the params hash anymore, within a link?


Old school:

<%= link_to ‘New message’, :controller => ‘messages’, :action => ‘new’,
:target_id => %>

RESTful new school:

<%= link_to ‘New message’, new_user_message_path(@user), :target_id => %>

-> But doing it like this just ignores the “:taget_id” that I need to
pass to the controller !

How should I do this using RESTful routes?

Thanks a lot for your help!

this will do

<%= link_to ‘New message’, new_user_message_path(@user, :target_id => %>

just pass the value within the pathhelper

Great! Thanks a lot, Thorsten!

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