标签: ruby-on-rails ruby-on-rails-4 rails-routing
我试图在控制器中屏蔽一个show动作的url,其id为“sample”但不会屏蔽:
get '/sample' => redirect("/posts/2"), :as => '/sample'
以上是什么问题?
答案 0 :(得分:0)
尝试: get "/sample" => "posts#show", id: 2
get "/sample" => "posts#show", id: 2