Created
December 16, 2009 15:31
-
-
Save wesrog/257912 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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