Rails 3 - routing
I don't know how to make a link_to because I'dont have a nouveau_message_path in rake routes
rake routes :
GET /nouveau_message/.:id {:action=>"nouveau_message", :controller=>"messages"}
routes.rb :
controller :messag开发者_JAVA技巧es do
get 'nouveau_message/.:id' => :nouveau_message
end
What is the best way to make a link_to to nouveau_message from another view ?
Thanks
There is a rake task really nice to let you know all about your routes' names.
rake routes
You will be able to see all your routes and their targets.
Anyway your routes should be something like
link_to 'Nouveau', nouveau_message_message_path(:id => YOURID)
But check with rake routes ;)
Hope this will help you !
EDIT : excuse me, for my previous answer.
Add this to your routes.rb
get 'nouveau_message/.:id' => :nouveau_message, :as => 'nouveau_message'
:as allows you to name your route !
精彩评论