Class: PagePart
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- PagePart
- Defined in:
- app/models/page_part.rb
Instance Method Summary collapse
Instance Method Details
#duplicate ⇒ Object
8 9 10 11 12 |
# File 'app/models/page_part.rb', line 8 def duplicate page_part = PagePart.new(self.attributes) page_part.save page_part end |
#to_s ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/page_part.rb', line 14 def to_s if content case filter when "none" content.html_safe when "textile" RedCloth.new(content).to_html.html_safe when "markdown" BlueCloth.new(content).to_html.html_safe when "erb" require "erb" eval(ERB.new(content).src).html_safe when "erb+textile" require "erb" textilize eval(ERB.new(content).src).html_safe when "html" content.html_safe end end end |