Note that there are some explanatory texts on larger screens.

plurals
  1. POWorking with nested hashes in Rails 3
    primarykey
    data
    text
    <p>I'm working with the Koala gem and the Facebook Graph API, and I want to break down the results I get for a users feed into separate variables for inserting into a mySQL database, probably using Active Record. Here is the code I have so far:</p> <pre><code>@token = Service.where(:provider =&gt; 'facebook', :user_id =&gt; session[:user_id]).first.token @graph = Koala::Facebook::GraphAPI.new(@token) @feeds = params[:page] ? @graph.get_page(params[:page]) : @graph.get_connections("me", "home") </code></pre> <p>And here is what @feeds looks like:</p> <pre><code> [{"id"=&gt;"1519989351_1799856285747", "from"=&gt;{"name"=&gt;"April Daggett Swayne", "id"=&gt;"1519989351"}, "picture"=&gt;"http://photos-d.ak.fbcdn.net/hphotos-ak-ash4/270060_1799856805760_1519989351_31482916_3866652_s.jpg", "link"=&gt;"http://www.facebook.com/photo.php?fbid=1799856805760&amp;set=a.1493877356465.2064294.1519989351&amp;type=1", "name"=&gt;"Mobile Uploads", "icon"=&gt;"http://static.ak.fbcdn.net/rsrc.php/v1/yx/r/og8V99JVf8G.gif", "type"=&gt;"photo", "object_id"=&gt;"1799856805760", "application"=&gt;{"name"=&gt;"Facebook for Android", "id"=&gt;"350685531728"}, "created_time"=&gt;"2011-07-03T03:14:04+0000", "updated_time"=&gt;"2011-07-03T03:14:04+0000"}, {"id"=&gt;"2733058_10100271380562998", "from"=&gt;{"name"=&gt;"Joshua Ramirez", "id"=&gt;"2733058"}, "message"=&gt;"Just posted a photo", "picture"=&gt;"http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=124024574287414&amp;v=1&amp;size=z&amp;cksum=228788edbab39cb34861aecd197ff458&amp;src=http%3A%2F%2Fimages.instagram.com%2Fmedia%2F2011%2F07%2F02%2F2ad9768378cf405fad404b63bf5e2053_7.jpg", "link"=&gt;"http://instagr.am/p/G1tp8/", "name"=&gt;"jtrainexpress's photo", "caption"=&gt;"instagr.am", "icon"=&gt;"http://photos-e.ak.fbcdn.net/photos-ak-snc1/v27562/10/124024574287414/app_2_124024574287414_6936.gif", "actions"=&gt;[{"name"=&gt;"Comment", "link"=&gt;"http://www.facebook.com/2733058/posts/10100271380562998"}, {"name"=&gt;"Like", "link"=&gt;"http://www.facebook.com/2733058/posts/10100271380562998"}], "type"=&gt;"link", "application"=&gt;{"name"=&gt;"Instagram", "id"=&gt;"124024574287414"}, "created_time"=&gt;"2011-07-03T02:07:37+0000", "updated_time"=&gt;"2011-07-03T02:07:37+0000"}, {"id"=&gt;"588368718_10150230423643719", "from"=&gt;{"name"=&gt;"Eric Bailey", "id"=&gt;"588368718"}, "link"=&gt;"http://www.facebook.com/pages/Martis-Camp/105474549513998", "name"=&gt;"Martis Camp", "caption"=&gt;"Eric checked in at Martis Camp.", "description"=&gt;"Rockin the pool", "icon"=&gt;"http://www.facebook.com/images/icons/place.png", "actions"=&gt;[{"name"=&gt;"Comment", "link"=&gt;"http://www.facebook.com/588368718/posts/10150230423643719"}, {"name"=&gt;"Like", "link"=&gt;"http://www.facebook.com/588368718/posts/10150230423643719"}], "place"=&gt;{"id"=&gt;"105474549513998", "name"=&gt;"Martis Camp", "location"=&gt;{"city"=&gt;"Truckee", "state"=&gt;"CA", "country"=&gt;"United States", "latitude"=&gt;39.282813917575, "longitude"=&gt;-120.16736760768}}, "type"=&gt;"checkin", "application"=&gt;{"name"=&gt;"Facebook for iPhone", "id"=&gt;"6628568379"}, "created_time"=&gt;"2011-07-03T01:58:32+0000", "updated_time"=&gt;"2011-07-03T01:58:32+0000", "likes"=&gt;{"data"=&gt;[{"name"=&gt;"Mike Janes", "id"=&gt;"725535294"}], "count"=&gt;1}}] </code></pre> <p>I have looked around for clues on this, and haven't found it yet (but I'm still working on my stackoverflow-foo). Any help would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload