Skip to content

Instantly share code, notes, and snippets.

@alaingoldman
Created November 25, 2013 22:36
Show Gist options
  • Select an option

  • Save alaingoldman/7650179 to your computer and use it in GitHub Desktop.

Select an option

Save alaingoldman/7650179 to your computer and use it in GitHub Desktop.
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