## # This is a representation of a page of the wiki. My wiki is awfully simple # because i don't like too many features. This works and it has many different # associations. All of the major models has_one of these and it belongs_to # some kind of polymorphic owner. # # Bonuses: # * Uses RedCloth markup. # * Automatically converts/caches HTML # * Allows any character or space in the name # * Uses [[ and ]] for WikiWord representation. # class Page < ActiveRecord::Base acts_as_versioned belongs_to :owner, :polymorphic => true validates_presence_of :title validates_uniqueness_of :title validates_format_of :title, :with => /[A-Za-z0-9 ]/, :message => 'may only contain letters, numbers and spaces' before_save :update_html protected ## # Updates the HTML chunk from the RedCloth source. # def update_html # need to filter HTML first... remove