finally implemented redirects for renames
This commit is contained in:
parent
5b0ccafc0e
commit
e62244acae
@ -42,6 +42,7 @@ module ActionDispatch::Routing
|
||||
# post /form for form processing
|
||||
# get /news/:id for any news posts
|
||||
# get /:id for any pages
|
||||
# redirects from any renamed page
|
||||
# root to /index unless options[:root] == false
|
||||
# mount the engine (make editing possible) unless production
|
||||
# or oprions[:production] == true (not recommended)
|
||||
@ -51,6 +52,15 @@ module ActionDispatch::Routing
|
||||
root "merged/view#page" , id: 'index'
|
||||
end
|
||||
|
||||
Merged::Page.all.each do |page|
|
||||
next unless page.redirects
|
||||
page.redirects.split.each do |old|
|
||||
next if old == page.name
|
||||
puts "redirect #{old} to #{page.name}"
|
||||
get "/#{old}" => redirect("/#{page.name}")
|
||||
end
|
||||
end
|
||||
|
||||
post "/form" , to: "merged/form#post" , as: :post_form
|
||||
get "/news/:id" , to: "merged/view#page" , id: :id , as: :view_blog
|
||||
get ":id" , to: "merged/view#page" , id: :id , as: :view_page
|
||||
|
Loading…
Reference in New Issue
Block a user