method

from_attributes

Importance_0
v6.0.0 - Show latest stable - 0 notes - Class: TrixAttachment
from_attributes(attributes) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actiontext/lib/action_text/trix_attachment.rb, line 19
      def from_attributes(attributes)
        attributes = process_attributes(attributes)

        trix_attachment_attributes = attributes.except(*COMPOSED_ATTRIBUTES)
        trix_attributes = attributes.slice(*COMPOSED_ATTRIBUTES)

        node = ActionText::HtmlConversion.create_element(TAG_NAME)
        node["data-trix-attachment"] = JSON.generate(trix_attachment_attributes)
        node["data-trix-attributes"] = JSON.generate(trix_attributes) if trix_attributes.any?

        new(node)
      end
Register or log in to add new notes.