Hello all,
I am working through the depot example in the rails book. If I add a validates_uniqueness_of to a string column in the model, and then try to create a record with a number in this string column I get an SQL error. Looks like the SQL generated to test for uniqueness does not quote the value if it's numeric even though it's comparing against a varchar column. It does something like this: (select * from products where title = 123) This of course needs 123 to be quoted in order for it to work.
I thought this would be an easy fix in the quote() method of sybase_adapter.rb but it appears to be doing the right thing by checking the column type.
I'd like to figure out if it's specific to the sybase adapter so if anyone can validates_uniqueness_of a string column and then pass an integer I'd appreciate it. Also that's the proper way of debugging sybase_adapter.rb's quote() method? At a minimum I'd like to pepper it with some print statements and be able to see the output in one of the log files.
thanks, Kiriakos ps. Few days into RoR, all I can say is wow