开发者

Comparing string before and after DB save in Rails?

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 o开发者_C百科f the characters are a few line endings and some dashes (-) here or there.


why you don't create an hash-code for that? create it before save, in validation check for the hash comparing. I don't suggest you to compare TEXT fields

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜