Итак, я делаю так на своем контроллере:
json_document = JSON(params) (json gem)
Если я печатаю json_document, это дает мне Json вот так:
{"createdAt":"Mar 6, 2012 6:12:54 PM","id":177139718620856322,"text":"@rgjunio where?","source":"web","isTruncated":false,"inReplyToStatusId":177139644012572673, ...
Но когда я пытаюсь получить к нему доступ:
tweet = Complaint.find_by_twitter_status json_document["inReplyToStatusId"]
я получаю следующую ошибку:
can't convert ActiveSupport::HashWithIndifferentAccess into String
Итак, я попробовал другой способ, используя символы:
tweet = Complaint.find_by_twitter_status json_document[:inReplyToStatusId]
но выдает ошибку:
TypeError (can't convert Symbol into Integer)
Есть идеи?
Обновление:
Если я использую params [: inReplyToStatusId] isntead, я получаю следующее:
ActiveRecord::StatementInvalid (PG::Error: ERROR: operator does not exist: character varying = bigint
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
SELECT "complaints".* FROM "complaints" WHERE "complaints"."twitter_status" = 177144980450721794 LIMIT 1):