Module: HasMarkup::Textile::ClassMethods

Defined in:
lib/has_markup/textile.rb

Instance Method Summary collapse

Instance Method Details

#validates_textile_syntax(*columns) ⇒ Object

Validates the markdown syntax of the given columns.



27
28
29
30
31
32
33
34
35
# File 'lib/has_markup/textile.rb', line 27

def validates_textile_syntax(*columns)
  validates_each(*columns) do |record, column, value|
    begin
      record.generate_html_from_markdown(value)
    rescue e
      record.errors.add column, "has #{e}"
    end
  end
end