I'm using the awesome neography gem and have run into a slight problem converting the results of a Cypher query to a structured object (OpenStruct.new... )
I don't know how to create a hash or a OpenStruct from the columns and data query results, which are
{"columns"=>["p.pd_challenge_id", "p.author_id"], "data"=>[["158", "88"], ["158", "90"], ["158", "99"], ["158", "95"], ["158", "97"]]}
I cannot create a usable hash from it. .I've tried several things including
["data"].map{|x|{ "challenge_id" => x[1],"author_id"=>x[0]}}.to_json
results in
{{"challenge_id":158, "author_id":88}, {"challenge_id":158, "author_id":90}, {"challenge_id":158, "author_id":99}} etc.. (to which I simply cannot convert to a hash or openstruct)
What I'm looking for is for something like the following stored in a struct object so the scaffolded view can read it unmodified:
{:challenge_id=>158, :author_id=>88}
{:challenge_id=>158, :author_id=>90}
{:challenge_id=>158, :author_id=>99}
my view would look for object.challenge_id
Now, I've tried to use to_sym on "challenge_id" to no avail while using .map method..
I've tried to Hash[@mydata] on ["data"] which also does not work
Is there a simple way to get all of this data into a structured object (OpenStruct.new .. ) so that my forms can simply read it as if it were reading the results of an active record query? I can do this with neo.get_node_properties but just can't seem to get this working right.