Created
November 15, 2013 19:03
-
-
Save davydovanton/7489769 to your computer and use it in GitHub Desktop.
link_to_custom
This file contains 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 link_to_custom(name, options = {link_name: name}) | |
page = cms_site.pages.find_by_label(name) | |
page = page.nil? ? "#" : page.full_path | |
link_options = options.select {|key, value| key != :link_name && key != :link_page } | |
link_to( page , link_options ) do | |
block_given? ? yield : options[:link_name] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment