Skip to content

Commit

Permalink
support of legacy routes
Browse files Browse the repository at this point in the history
  • Loading branch information
ck3g committed Apr 6, 2013
1 parent e5c0d3f commit 6112625
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 11 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.