Module: Skyline::Sections::Interface

Defined in:
lib/skyline/sections/interface.rb

Overview

Defines the section interface. Include this module in all your sections.

If you’re creating your Section within the Skyline module (you probably shouldn’t), it will automatically sets your models table name to ‘skyline_sections_#basebase.table_name`

class Model < ActiveRecord::Base

include Skyline::Sections::Interface

end

class Model < ActiveRecord::Base

has_one :section, :as => :sectionable, :class_name => "Skyline::Section" # The link back to the section
self.default_interface = true # defaults to true

def to_text
  ...
end

end

Examples:

Usage:

Defines the following interface:

Instance Method Summary collapse

Instance Method Details

#to_textString

This method is abstract.

Implement in your own section

The to_text method is needed for searching and other string operations which just want the content of this section without any markup.

Returns:

  • (String)

    The section’s content flattened to only text



39
40
41
# File 'lib/skyline/sections/interface.rb', line 39

def to_text
  ""
end