2013-07-29 2 views
0

나는 그것의 < 기호 값을 삽입하기 위해 노력하고있어,하지만 때마다, 그냥 문자열의 나머지 차단에 SQL 삽입에 대한 기호보다 적은 탈출하는 방법 :DataMapper

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 " 

이 문제를 해결하는 방법은 무엇입니까?

답변

0

괜찮 았습니다.

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