Forum: Ruby on Rails Validation on special characters

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Clem R. (Guest)
on 2007-07-04 18:33
(Received via mailing list)

    I'm trying to make a validation that catches special latin chars
cause Mysql errors.

Here's what I've been trying so far:

validates_format_of :title, :with=>/\A[^#]/, :message=>'must not start
a "#"', :if => {|page| page.title && page.title.size > 0 }

  validates_exclusion_of :title, :in => 'π ≤ ≥ ∫ √ ≈ Ω ∞ ≠ ∑ 
∂ ∆ ˙ ˚',
:message => "Title contains invalid characters"

When I throw these characters into the textfield, they aren't dectected
the sql error is thrown.

View this message in context:
Sent from the RubyOnRails Users mailing list archive at
This topic is locked and can not be replied to.