module Slightcms class Part < ActiveRecord::Base # Change default table name set_table_name "slightcms_page_parts" # Associations belongs_to :page, :class_name => "Slightcms::Page" # Validations validates_presence_of :name validates_uniqueness_of :name, :scope => :page_id validates_presence_of :content protected # Render the part's content def render_content RedCloth.new(self.content).to_html end end end