I'm looking to redirect all routes in a Rails namespace to the root path. Here's what I have so far. It works, but I wanted to see if I could get it into a single line:
namespace "old_namespace" do
match "/", :to => redirect("/")
match "*path", :to => redirect("/")
end
namespace :old_namespace do
match '(*any)' , to: redirect('/')
end
namespace :old_namespace do
match '(*any)' , to: redirect('/'), via: [:get, :post]
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With