Class: TextBlock

Inherits:
Context show all
Defined in:
app/models/contexts/text_block.rb

Overview

Defines a plain block of html based content to be output directly to the page. Typically used with wysiwyg editors etc.

Instance Method Summary collapse

Methods inherited from Context

#context_type, #set_default_position

Instance Method Details

#as_json(options = {}) ⇒ Object



25
26
27
28
# File 'app/models/contexts/text_block.rb', line 25

def as_json(options = {})
  options.merge!({ :only => [:body] })
  super(options)
end

#deliverObject

Contexts are delivered either internally or via helper method. If the deliver method exists on a resource, it is used. In this case, text blocks always simply deliver their content.



21
22
23
# File 'app/models/contexts/text_block.rb', line 21

def deliver
  self.body.to_s.html_safe
end