123456789_123456789_123456789_123456789_123456789_

Module: ActionText::Attachments::TrixConversion

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: actiontext/lib/action_text/attachments/trix_conversion.rb

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

append_features, prepend_features

Instance Method Summary

Instance Method Details

#to_trix_attachment(content = trix_attachment_content)

[ GitHub ]

  
# File 'actiontext/lib/action_text/attachments/trix_conversion.rb', line 24

def to_trix_attachment(content = trix_attachment_content)
  attributes = full_attributes.dup
  attributes["content"] = content if content
  TrixAttachment.from_attributes(attributes)
end

#trix_attachment_content (private)

[ GitHub ]

  
# File 'actiontext/lib/action_text/attachments/trix_conversion.rb', line 31

def trix_attachment_content
  if partial_path = attachable.try(:to_trix_content_attachment_partial_path)
    ActionText::Content.render(partial: partial_path, formats: :html, object: self, as: model_name.element)
  end
end