class method self.from_attributes

Ruby on Rails 6.1.7.10

Since v6.0.6

Available in: v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

self.from_attributes(attributes)

No documentation comment.

Parameters

attributes req
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

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

Defined in ActionText::TrixAttachment

Type at least 2 characters to search.

↑↓ navigate · open · esc close