Skip to content

Instantly share code, notes, and snippets.

@lukewendling
Created May 3, 2012 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukewendling/2588837 to your computer and use it in GitHub Desktop.
Save lukewendling/2588837 to your computer and use it in GitHub Desktop.
def ApplicationController
# perhaps in a mixin
def permanent_redirect_to(options)
url = case options
when String
options
else
url_for(options)
end
head :moved_permanently, :location => url
end
end
def StaticPagesController < ApplicationController
def obsolete_page
permanent_redirect_to new_page_url
# or, permanent_redirect_to 'url_string'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment