Class: ActionText::Attachables::MissingAttachable

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Defined in:
lib/action_text/attachables/missing_attachable.rb

Constant Summary collapse

DEFAULT_PARTIAL_PATH =
"action_text/attachables/missing_attachable"

Instance Method Summary collapse

Constructor Details

#initialize(sgid) ⇒ MissingAttachable

Returns a new instance of MissingAttachable.



12
13
14
# File 'lib/action_text/attachables/missing_attachable.rb', line 12

def initialize(sgid)
  @sgid = SignedGlobalID.parse(sgid, for: ActionText::Attachable::LOCATOR_NAME)
end

Instance Method Details

#modelObject



24
25
26
# File 'lib/action_text/attachables/missing_attachable.rb', line 24

def model
  @sgid&.model_name.to_s.safe_constantize
end

#to_partial_pathObject



16
17
18
19
20
21
22
# File 'lib/action_text/attachables/missing_attachable.rb', line 16

def to_partial_path
  if model
    model.to_missing_attachable_partial_path
  else
    DEFAULT_PARTIAL_PATH
  end
end