Class: ActionText::Attachables::ContentAttachment
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: | Object |
Defined in: | actiontext/lib/action_text/attachables/content_attachment.rb |
Class Method Summary
::ActiveModel::Naming
- self
param_key | Returns string to use for params names. |
plural | Returns the plural class name of a record or class. |
route_key | Returns string to use while generating route names. |
singular | Returns the singular class name of a record or class. |
singular_route_key | Returns string to use while generating route names. |
uncountable? | Identifies whether the class name of a record or class is uncountable. |
Instance Attribute Summary
- #name rw
::ActiveModel::Model
- Included
#_validators, #_validators?, | |
#persisted? | Indicates if the model is persisted. |
#validation_context |
::ActiveModel::AttributeAssignment
- Included
Instance Method Summary
- #attachable_plain_text_representation(caption)
- #to_partial_path
- #to_trix_content_attachment_partial_path
::ActiveModel::Model
- Included
#initialize | Initializes a new model with the given |
::ActiveModel::Conversion
- Included
#to_key | Returns an |
#to_model | If your object is already designed to implement all of the Active Model you can use the default |
#to_param | Returns a |
#to_partial_path | Returns a |
::ActiveModel::Validations
- Included
#errors | Returns the |
#invalid? | Performs the opposite of |
#read_attribute_for_validation | Hook method defining how an attribute value should be retrieved. |
#valid? | Runs all the specified validations and returns |
#validate | Alias for ActiveModel::Validations#valid?. |
#validate! | Runs all the validations within the specified context. |
#validates_with | Passes the record off to the class or classes specified and allows them to add errors based on more complex conditions. |
#raise_validation_error |
::ActiveModel::AttributeAssignment
- Included
#assign_attributes | Allows you to set all the attributes by passing in a hash of attributes with keys matching the attribute names. |
Class Method Details
.from_node(node)
[ GitHub ]# File 'actiontext/lib/action_text/attachables/content_attachment.rb', line 8
def self.from_node(node) if node["content-type"] if matches = node["content-type"].match(/vnd\.rubyonrails\.(.+)\.html/) = new(name: matches[1]) if .valid? end end end
Instance Attribute Details
#name (rw)
[ GitHub ]# File 'actiontext/lib/action_text/attachables/content_attachment.rb', line 17
attr_accessor :name
Instance Method Details
#attachable_plain_text_representation(caption)
[ GitHub ]# File 'actiontext/lib/action_text/attachables/content_attachment.rb', line 20
def attachable_plain_text_representation( ) case name when "horizontal-rule" " ┄ " else " " end end
#to_partial_path
[ GitHub ]# File 'actiontext/lib/action_text/attachables/content_attachment.rb', line 29
def to_partial_path "action_text/attachables/content_attachment" end
#to_trix_content_attachment_partial_path
[ GitHub ]# File 'actiontext/lib/action_text/attachables/content_attachment.rb', line 33
def "action_text/attachables/content_attachments/#{name.underscore}" end