Created
November 25, 2013 22:36
-
-
Save alaingoldman/7650179 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 render_option(url_options) | |
| custom_render = false | |
| url_options[:custom][:urls].each do |url| | |
| if current_path == url | |
| custom_render = true | |
| break | |
| elsif [current_path] == url_options[:custom][:other_urls] | |
| custom_render = "other" | |
| break | |
| elsif [current_path] == ["/articles"] or current_path[0,17] == "/carbon_projects/" or current_path[0,10] == "/articles/" | |
| custom_render = "other" | |
| break | |
| else | |
| custom_render = false | |
| end | |
| end | |
| if custom_render == true | |
| render :partial => url_options[:custom][:render] | |
| elsif custom_render == "other" | |
| render :partial => url_options[:custom][:other_render] | |
| else | |
| render :partial => url_options[:default] | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment