4
이 경로에 대한 경로 헬퍼를 만드는 방법은 무엇입니까? 레일 3.1.3 날짜 별 맞춤 라우팅
resources :news
match 'news/:year/:month/:day' => 'news#show',
:constraints => { :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/ },
:as => 'newsdate'
나는 그것을 여러 가지 방법을 시도하지만, 작동하지 :
link_to news.created_at.strftime '%d.%m.%Y ', newsdate_path(:year => '2011', :month => '11', :day => '11')
나는 GET http://localhost:3000/news하여이 라인 응용 프로그램 오류 :
ArgumentError in News#index
Showing /home/foxweb/work/dev/app/views/news/index.html.slim where line #6 raised:
wrong number of arguments (2 for 1)
이 어떻게 올바른 방법으로 만들기 위해?
P. http://localhost:3000/news/2011/11/11이 문제가 없습니다.
즉, 링크가 아닌 경로에서 오류가 발생하고 있습니다. –
그래,하지만 ... 라우팅 오류 '경로 일치 {: controller => "news", : action => "show", : year => 2004, : month => 9, : day => 15}' – foxwwweb
'레이크 루트'출력을 보여주십시오. –