2

我该如何重定向

get '/directory/:alphabet' => redirect('/directory/:alphabet/1') , :constraints => { :alphabet => /[A-Za-z#]/}

这会引发有关字母表的错误。我如何使用我得到的价值?

4

1 回答 1

2

请参阅http://guides.rubyonrails.org/routing.html#redirection下的“动态段”

使用 %{alphabet} 从源中读取值

get '/directory/:alphabet' => redirect('/directory/%{alphabet}/1') , :constraints => { :alphabet => /[A-Za-z#]/}
于 2013-08-31T12:35:22.770 回答