Reputation: 25348
I have to manually redirect a set of URLs, but seems like there's got to be a more efficient way (in terms of # of lines) than what I've currently go.
match "/articles/care" => redirect("/articles/category/care")
match "/articles/food-diet" => redirect("/articles/category/food-diet")
match "/articles/basics" => redirect("/articles/category/basics")
match "/articles/training" => redirect("/articles/category/training")
match "/articles/recipes" => redirect("/articles/category/recipes")
match "/articles/life" => redirect("/articles/category/life")
Upvotes: 0
Views: 114
Reputation: 2509
Try this out:
for category in %w{ care food-diet training recipes life }
match "/articles/#{category}" => redirect("/articles/category/#{category}")
end
Upvotes: 3