instance method
alt
Ruby on Rails edge
Since edgeSignature
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