Sha256: c970bf7a3875ffa0cdd8e25307d9c4b5a7fc19a09f2a3ba4f10656bad1bd55d6
Contents?: true
Size: 442 Bytes
Versions: 10
Compression:
Stored size: 442 Bytes
Contents
class PagePart < ActiveRecord::Base belongs_to :page validates :title, :presence => true alias_attribute :content, :body def to_param "page_part_#{self.title.downcase.gsub(/\W/, '_')}" 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
10 entries across 10 versions & 1 rubygems