Skip to content

Instantly share code, notes, and snippets.

@superp
Created February 28, 2011 13:39
Show Gist options
  • Save superp/847323 to your computer and use it in GitHub Desktop.
Save superp/847323 to your computer and use it in GitHub Desktop.
rails 2 routes redirect
#routes.rb
map.articles '/articles', :controller => 'posts', :action=>'index'
map.posts '/posts', :controller => 'posts', :action=>'redirect'
map.resources :posts
#posts_controller.rb
def redirect
redirect_to articles_path, :status => 301
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment