Permalink
Browse files

support of legacy routes

  • Loading branch information...
1 parent e5c0d3f commit 6112625fd99d2aabb885b3a082bf1a5de67f3115 @ck3g committed Apr 6, 2013
Showing with 16 additions and 0 deletions.
  1. +5 −0 app/controllers/articles_controller.rb
  2. +11 −0 config/routes.rb
View
5 app/controllers/articles_controller.rb
@@ -53,6 +53,11 @@ def restore
private
def find_article
+ if params[:legacy_id]
+ article = Article.find_by_legacy_id(params[:legacy_id])
+ redirect_to article, :status => :moved_permanently
+ return
+ end
@article = Article.accessible_by(current_ability).find params[:id]
end
end
View
11 config/routes.rb
@@ -1,6 +1,16 @@
Sc2News::Application.routes.draw do
mount Ckeditor::Engine => '/ckeditor'
+ # support of legacy routes
+ get "/News" => redirect("/articles")
+ get "/News/Details/:legacy_id" => "articles#show"
+ get "/TagsCloud" => redirect("/tags")
+ get "/Home/Jobs" => redirect("/pages/jobs")
+ get "/Home/About" => redirect("/pages/about")
+ get "/Account/Register" => redirect("/users/sign_up")
+ get "/Account/PasswordReset" => redirect("/users/password/new")
+ get "/Account/LogOn" => redirect("/users/sign_in")
+
devise_for :users
resources :articles do
@@ -23,6 +33,7 @@
put :sync, on: :member
end
get "profile/:username" => "profiles#show", as: :user_profile
+ get "Profile/:username" => "profiles#show"
root :to => 'articles#index'
end

0 comments on commit 6112625

Please sign in to comment.