Skip to content

Instantly share code, notes, and snippets.

@psahni
Forked from chrisbloom7/application.html.erb
Created August 3, 2011 06:48
Show Gist options
  • Save psahni/1122051 to your computer and use it in GitHub Desktop.
Save psahni/1122051 to your computer and use it in GitHub Desktop.
Static named redirect routes in Rails 3
<ul class="social-links">
<li class="facebook"><%= link_to "Like us on Facebook", facebook_path %></li>
<li class="twitter"><%= link_to "Follow us on Twitter", twitter_path %></li>
</ul>
Myapplication::Application.routes.draw do
match "/facebook" => redirect("http://www.facebook.com/pages/MarkZuckerbergFanClub/12345678"), :as => 'facebook'
match "/twitter" => redirect("http://twitter.com/TweetyMcTweet"), :as => 'twitter'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment