Validation on special characters


#1

Hello,

I'm trying to make a validation that catches special latin chars 

that
cause Mysql errors.

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

validates_format_of :title, :with=>/\A[^#]/, :message=>‘must not start
with
a “#”’, :if => Proc.new {|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
and
the sql error is thrown.


View this message in context:
http://www.nabble.com/Validation-on-special-characters-tf4024691.html#a11431779
Sent from the RubyOnRails Users mailing list archive at Nabble.com.