Skip to content

Instantly share code, notes, and snippets.

@thesunwave
Forked from Tyralion/include_path.rb
Created March 15, 2016 08:31
Show Gist options
  • Save thesunwave/dcfe6519c33f58450d2f to your computer and use it in GitHub Desktop.
Save thesunwave/dcfe6519c33f58450d2f to your computer and use it in GitHub Desktop.
def include_path?(options)
return false unless request
url_string = url_for(options)
if url_string.index("?")
request_uri = request.fullpath
else
request_uri = request.path
end
if url_string =~ /^\w+:\/\//
request_uri = "#{request.protocol}#{request.host_with_port}#{request_uri}"
end
!request_uri.index(url_string).nil?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment