Skip to content

Instantly share code, notes, and snippets.

@therubymug
Created September 9, 2010 21:46
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 therubymug/572648 to your computer and use it in GitHub Desktop.
Save therubymug/572648 to your computer and use it in GitHub Desktop.
def path_to(page_name)
case page_name
when 'the homepage'
root_path
when /^the ([\w ]+) page$/
send("#{$1.gsub(/\W+/, '_')}_path")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment