Flowdock
method

image_alt

Importance_1
Ruby on Rails latest stable (v4.1.8) - 0 notes - Class: ActionView::Helpers::AssetTagHelper
image_alt(src) public

Returns a string suitable for an html image tag alt attribute. The src argument is meant to be an image file path. The method removes the basename of the file path and the digest, if any. It also removes hyphens and underscores from file names and replaces them with spaces, returning a space-separated, titleized string.

Examples

image_alt('rails.png')
# => Rails

image_alt('hyphenated-file-name.png')
# => Hyphenated file name

image_alt('underscored_file_name.png')
# => Underscored file name
Show source
Register or log in to add new notes.