instance method alt

Ruby on Rails edge

Since edge

Signature

alt()

Returns the alternative text describing the attachment, used as the alt attribute when rendering an image.

A caption is shown alongside the attachment, whereas alternative text describes it for people who cannot see it. They serve different purposes, so an attachment may have either, both, or neither.

attachment = ActionText::Attachment.from_attachable(attachable, alt: "A racecar on a track")
attachment.alt # => "A racecar on a track"
Source
# File actiontext/lib/action_text/attachment.rb, line 87
    def alt
      node_attributes["alt"].presence
    end

Defined in actiontext/lib/action_text/attachment.rb line 87 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionText::Attachment

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close