Skip to content

Instantly share code, notes, and snippets.

@wesrog
Created December 16, 2009 15:31
Show Gist options
  • Save wesrog/257912 to your computer and use it in GitHub Desktop.
Save wesrog/257912 to your computer and use it in GitHub Desktop.
def public_url_to(resource)
if resource.respond_to?(:slug)
if resource.is_a?(Article)
yield post_url(resource.to_url)
elsif resource.is_a?(Page)
yield page_url(resource.slug)
else
yield resource
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment