0

我试图在其中插入一个带有<符号的值,但每次,它都会切断字符串的其余部分:

winecheap = Tag.first_or_create(:tag_type => tt, :value => "Wine & Spirits <$65")

  DEBUG -  (0.000828) SELECT "uuid", "created_at", "updated_at", "value", "es_indexed", "tag_type_uuid" FROM "tags" WHERE ("tag_type_uuid" = 'a932f2c1-e8bb-44cc-9120-791097474b77' AND "value" = 'Wine & Spirits <$65') ORDER BY "uuid" LIMIT 1
  DEBUG -  (0.001027) INSERT INTO "tags" ("created_at", "updated_at", "uuid", "value", "es_indexed", "tag_type_uuid") VALUES ('2013-07-29T20:03:32+00:00', '2013-07-29T20:03:32+00:00', '76a5b023-41b6-4e6b-9f2b-e9fbe51ee1b0', 'Wine & Spirits ', FALSE, 'a932f2c1-e8bb-44cc-9120-791097474b77')
 => #<Tag @created_at=Mon, 29 Jul 2013 20:03:32 +0000 @updated_at=Mon, 29 Jul 2013 20:03:32 +0000 @uuid=#<UUID:0x3fdb200f4e6c UUID:76a5b023-41b6-4e6b-9f2b-e9fbe51ee1b0> @value="Wine & Spirits " @es_indexed=false @tag_type_uuid=#<UUID:0x3fdb1f2b8290 UUID:a932f2c1-e8bb-44cc-9120-791097474b77>>
1.9.3-p286 :079 
> winecheap.value
 => "Wine & Spirits "

这有什么办法?

4

1 回答 1

0

这工作正常。

repository(:default).adapter.execute('UPDATE "tags" SET "value"=\'Wine & Spirits <$65\' WHERE "uuid" = \'0cfa3a0c-adfb-4b67-92af-a7ee46d9289c\'')
于 2013-07-29T20:29:01.480 回答