Sha256: 05c5f9b70d2c6e61b1dd4afb96d11809cf814b1392d210f1ecaa21ff0138d83b
Contents?: true
Size: 434 Bytes
Versions: 14
Compression:
Stored size: 434 Bytes
Contents
class PagePart < ActiveRecord::Base belongs_to :page validates_presence_of :title alias_attribute :content, :body def to_param "page_part_#{self.title.downcase.gsub(" ", "_")}" end before_save :normalise_text_fields protected def normalise_text_fields unless self.body.blank? or self.body =~ /^\</ self.body = "<p>#{self.body.gsub("\r\n\r\n", "</p><p>").gsub("\r\n", "<br/>")}</p>" end end end
Version data entries
14 entries across 14 versions & 1 rubygems