2012-06-18 2 views
1

FriendlyID를 사용하여 일부 모델에 슬러그를 생성하고 있습니다. FriendlyID 슬러그에서 리소스 이름을 숨기기

가 FriendlyID 문서 ( http://rubydoc.info/github/norman/friendly_id/master/frames)에서 제공하는 예제를 사용하려면, 내 URL은 현재 다음과 같이 :

http://localhost:3000/cities/seattle/restaurants/joes-diner 

내 경우에는, 도시가 난, 레스토랑,하지만 아무것도하지 않을 것이라고 감안할 때 그것과 같을 것이다 있도록 URL에서 "레스토랑"비트를 제거하는 방법을 찾고 :

http://localhost:3000/cities/seattle/joes-diner 

또는 가능한 경우도

http://localhost:3000/seattle/joes-diner 

이 작업을 수행하는 가장 좋은 방법은 무엇입니까? 마지막 옵션으로 인해 합병증이 생길 수도 있습니다.

+1

당신이 아직 이름 경로 봤어? [공식 문서는 여기에 있습니다.] (http://guides.rubyonrails.org/routing.html) –

답변