Skip to content

Instantly share code, notes, and snippets.

@abrambailey
Created November 30, 2012 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abrambailey/4174971 to your computer and use it in GitHub Desktop.
Save abrambailey/4174971 to your computer and use it in GitHub Desktop.
truncate with full length tooltip
def trunk(input, length, *path)
shorten = truncate(input, :length => length)
if path.empty?
return content_tag(:span, shorten, :rel=>"tooltip", :title=>input)
else
return link_to shorten, path[0], :rel=>"tooltip", :title=>input
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment