Skip to content

Instantly share code, notes, and snippets.

@therubymug
Created September 9, 2010 21:46
Show Gist options
  • 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