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

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -