method

from_node

Importance_1
v7.1.3.2 - Show latest stable - 0 notes - Class: Attachable
from_node(node) public

Extracts the +ActionText::Attachable+ from the attachment HTML node:

person = Person.create! name: "Javan"
html = %Q(<action-text-attachment sgid="#{person.attachable_sgid}"></action-text-attachment>)
fragment = ActionText::Fragment.wrap(html)
attachment_node = fragment.find_all(ActionText::Attachment.tag_name).first
ActionText::Attachable.from_node(attachment_node) # => person
Show source
Register or log in to add new notes.