29 Jun '12, 11pm

Turns out sequel has great support for postgresql's json datatype. Example: https://t.co/YAGj9fEY

The pg_json extension adds support for Sequel to handle PostgreSQL's json type. It is slightly more strict than the PostgreSQL json type in that the object returned must be an array or object (PostgreSQL's json type considers plain numbers and strings as valid). This is because Sequel relies completely on the ruby JSON library for parsing, and ruby's JSON library does not accept the values. This extension integrates with Sequel's native postgres adapter, so that when json fields are retrieved, they are parsed and returned as instances of Sequel::Postgres::JSONArray or Sequel::Postgres::JSONHash . JSONArray and JSONHash are DelegateClasses of Array and Hash , so they mostly act the same, but not completely (json_array.is_a?(Array ) is false). If you want the actual array for a JSONArray, call JSONArray#to_a. If you want the actual hash for a JSONHash, call JSONHash#to_hash....

Full article: http://sequel.rubyforge.org/rdoc-plugins/files/lib/sequel...

Tweets

Feature - Right to BRAG: Fitness advocate sets example: Capt. Ronald H. Helms, a mental health nurse with the 94...

Feature - Right to BRAG: Fitness advocate sets ...

afrc.af.mil 01 Jul '12, 2am

-- Capt. Ronald H. Helms, a mental health nurse with the 94th Aeromedical Staging Squadron at Dobbins Air Reserve Base, Ga...