2012-01-05 99 views
0

我的路線看起來是這樣的:路徑館藏資源與Ruby on Rails的3

資源:帖子做

collection do 

    get :search 

end 

我可以創建具有以下的職位的路徑:

path = posts_path

如何創建「searc」路徑h「集合?

我知道如何做到這一點是這樣的,唯一的方法:

SEARCH_PATH = 「#{} posts_path /搜索」

必須有一個更好的辦法。

回答

3

要列出配置的路線,請使用rake routes。你在上面做的命名路線是search_posts_path

+0

酷!從來不知道耙路線命令。謝謝。 – tdewell 2012-01-06 03:37:31