Hi,
I have an odd problem when trying to match a hyphen in a
validates_format_of validation:
class DataDate < ActiveRecord::Base
validates_format_of :date, :with => /-/
end
If I try to create a new instance either in my test method or in
script/console:
test = DataDate.new(:date => ‘2007-08-10’)
=> #<DataDate id: nil, date: nil, created_at: nil, updated_at: nil>test.valid?
=> false
I get a ‘is invalid’ error on the date.
Does anyone have any idea why this might be.
script/console and my unit test report $KCODE to be UTF8 - I thought
it might be character encoding but apparently not. I’ve set the
character encoding in my terminal, the class and unit test files and
when using script/console to be UTF8/NONE but neither makes any
difference.
I’m on a Mac, using TextMate which saves the files in UTF8, using edge
rails revision 7277, mysql5.
Any help at all would be really appreciated as I have no idea what
else to do!
Thanks in advance.
Toby