views:

113

answers:

1

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 :messages 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

A: 

Hi,

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 !

Arkan
Thanks for your reply but I don't have nouveau_message_message_path, I 've use rake routes (see my post) : I have blank instead of a path helper in rake routes.
akam
Excuse me, I hadn't see you had used rake routes !Simply add this into your route file.get 'nouveau_message/.:id' => :nouveau_message, :as => 'nouveau_message'
Arkan
Thanks a lot :)
akam