如何重定向
get '/directory/:alphabet' => redirect('/directory/:alphabet/1') , :constraints => { :alphabet => /[A-Za-z#]/}
这会引发有关字母的错误。我如何使用我得到的值?
答案 0 :(得分:2)
请参阅http://guides.rubyonrails.org/routing.html#redirection
下的“动态细分”使用%{alphabet}从源
中读取值get '/directory/:alphabet' => redirect('/directory/%{alphabet}/1') , :constraints => { :alphabet => /[A-Za-z#]/}