ruby sequel access json field -
i have following schema:
 column  |            type             |       modifiers         ---------+-----------------------------+------------------------  id      | text                        | not null  data    | json                        | not null  created | timestamp without time zone | not null default now()   if open psql can run query.
select id, data->'amount' amount plans;   but ruby sequel gem ruins it.
puts $db.run("select id, data->'amount' amount plans")   what's wrong?
needed #literal method.
$db.run("select id, data -> #{ $db.literal('amount') } amount plans")      
Comments
Post a Comment