Skip to content

Instantly share code, notes, and snippets.

@dariocravero
Created October 3, 2010 22:47
Show Gist options
  • Save dariocravero/609023 to your computer and use it in GitHub Desktop.
Save dariocravero/609023 to your computer and use it in GitHub Desktop.
if !absolute_map or !@_map.blank?
# Add any controller level map to the front of the path
path = "#{@_map}/#{path}".squeeze('/')
# Small reformats
path.gsub!(%r{/?index/?}, '') # Remove index path
path[0,0] = "/" unless path =~ %r{^\(?/} # Paths must start with a /
path.sub!(%r{/(\))?$}, '\\1') # Remove latest trailing delimiter
path.gsub!(/\/(\(\.|$)/, '\\1') # Remove trailing slashes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment