Class: Workarea::Content::BlockDraft
- Inherits:
-
Object
- Object
- Workarea::Content::BlockDraft
show all
- Includes:
- ApplicationDocument
- Defined in:
- app/models/workarea/content/block_draft.rb
Instance Method Summary
collapse
#releasable?
add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list
#embedded_children
Instance Method Details
#block_type ⇒ Object
26
27
28
29
|
# File 'app/models/workarea/content/block_draft.rb', line 26
def block_type
return unless type_id.present?
Configuration::ContentBlocks.types.detect { |bt| bt.id == type_id.to_sym }
end
|
#content ⇒ Object
22
23
24
|
# File 'app/models/workarea/content/block_draft.rb', line 22
def content
Content.find(content_id)
end
|
#to_block ⇒ Object
37
38
39
40
41
|
# File 'app/models/workarea/content/block_draft.rb', line 37
def to_block
result = Content::Block.instantiate(as_document.except('content_id'))
result.new_record = true
result
end
|
#typecast_data! ⇒ Object
31
32
33
34
35
|
# File 'app/models/workarea/content/block_draft.rb', line 31
def typecast_data!
return unless type_id.present? && data.present?
self.data = block_type.try(:typecast!, data)
self
end
|