Q:

Having Issues Returning A Value Based on a Hash Key

I'm having difficulty accessing a particular value from a Koala GraphCollection object (represented as a Ruby hash). I am successfully returning the following data from a Facebook test user (This is a page object connected with the User):
[{"name"=>"Product Name", "access_token"=>"--Access Token Goes Here--", 
"category"=>"Baby goods/kids goods", "id"=>"244624772329824", "perms"=>["ADMINISTER", 
"EDIT_PROFILE", "CREATE_CONTENT", "MODERATE_CONTENT", "CREATE_ADS", "BASIC_ADMIN"]}]

What I would like to do is present the ID Value in my Rails view be accessing a class method from the view. The method in the model looks like this:
accounts = facebook.get_connection("me", "accounts")
accounts.each { |f| f['id'] }

The code in the view simply calls the method: 
<%= current_user.my_page_id %> 

The result of this attempt is simply returning the full data collection outlined above. I've tried several other Ruby Hash techniques, but most result in "Can't Convert String to Integer".
I'm using Rails 3.2, Ruby 1.9.3p125. 
Thanks much!

A:

If you're only ever expecting a single id from that method, change it to 
def my_page_id
  facebook.get_connection("me","accounts").first["id"]
end

