Detectando erros de sintaxe

This commit is contained in:
2008-03-08 18:52:26 -03:00
parent 4d4433da4e
commit 45f1a1e8d8

View File

@@ -31,6 +31,14 @@ class WikiPage < ActiveRecord::Base
acts_as_versioned :if_changed => [ :content, :description, :title ]
self.non_versioned_fields << 'position'
def validate
begin
to_html
rescue
errors.add("content", "possui erro de sintaxe")
end
end
def to_html(text = self.content)
return BlueCloth.new(text).to_html
end