If I use http://0.0.0.0:3000/users/25/messages/new
I can create a new message ressource for user 25 that’s OK…
I would like to be able to use such url :
http://0.0.0.0:3000/users/25/messages;send?to=5
in order to create a new message from user 25 for a specific receiver
how should write my route ? I tried…
map.resources :users do |users|
users.resources :messages, :member => { :send => :get }
end
but I got an error
no route found to match “/users/25/messages;send” with {:method=>:get}
thanks
kad
On Jun 12, 2007, at 6:14 AM, Kad K. wrote:
kad
map.resources :users do |users|
users.resources :messages, :new => { :send => :get }
end
And then, of course, it’s up to you to provide the :to => receiver.id
in your send_new_message_path() helper: send_new_message_path(:to =>
receiver)
gives you:
/users/25/messages/new;send?to=5
OR:
map.resources :users do |users|
users.resources :messages, :collection => { :send => :get }
end
and then: send_messages_path(:to => receiver)
gives you:
/users/25/messages;send?to=5
-Rob
Rob B. http://agileconsultingllc.com
[email protected]