Class: Skyline::Section
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Skyline::Section
- Defined in:
- app/models/skyline/section.rb
Instance Method Summary collapse
- #build_sectionable(sectionable_attributes) ⇒ Object
- #clone ⇒ Object
-
#to_text ⇒ Object
- to_text ==== returns String
-
plain text of section.
Instance Method Details
#build_sectionable(sectionable_attributes) ⇒ Object
14 15 16 17 18 19 |
# File 'app/models/skyline/section.rb', line 14 def build_sectionable(sectionable_attributes) params = sectionable_attributes.dup raise ArgumentError, "Missing class parameter when building sectionable" unless params["class"] klass = params.delete("class") self.sectionable = klass.constantize.new(params) end |
#clone ⇒ Object
21 22 23 24 25 |
# File 'app/models/skyline/section.rb', line 21 def clone returning super do |clone| clone.sectionable = self.sectionable.clone end end |
#to_text ⇒ Object
to_text
returns
- String
-
plain text of section
30 31 32 |
# File 'app/models/skyline/section.rb', line 30 def to_text self.sectionable.to_text end |