I am trying to validate uniqueness on an article description. After I save it to the DB, if I retrieve it it comes back in a stripped down format (missing some chars). If I put a validator on the uniquness of the text in the desc. it doens't get called. If I do a find_by_desc it fails since the text is slightly different. Any ideas? I know the table is UTF-8, but really most of the characters are a few line endings and some dashes (-) here or there.
-
It appears that if I convert them to UTF before saving them, then the next time I try to save the same description, I get the error I want: i = Iconv.new('UTF-8','LATIN1') story = i.iconv(story[0]) but this feels hackishtesserakt– tesserakt2010-07-08 03:59:29 +00:00Commented Jul 8, 2010 at 3:59
-
what is the db you are using?Aaron Qian– Aaron Qian2010-07-08 12:37:56 +00:00Commented Jul 8, 2010 at 12:37
-
to my knowledge, most db cannot do comparisons or ordering with text fields due to performance reasons, and this explains why uniqueness check fails to run. Also, checking uniqueness on article description sounds strange. can you explain a bit more?Aaron Qian– Aaron Qian2010-07-08 12:39:21 +00:00Commented Jul 8, 2010 at 12:39
Add a comment
|