Flowdock
method

image_alt

Importance_1
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: ActionView::Helpers::AssetTagHelper

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v5.2.3) is shown here.

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.