facebook - rails accessing value from facebooker hash/array -


this first time using facebooker plugin rails, , i'm having trouble accessing user info. website uses fb connect authenticate users.

i trying name of university logged in user attends.

when use command <%= facebook_session.user.education_history[:name] %>, error "symbol array index".

i have tried using education_history[1], returns "# facebooker::educationinfo:<some sort of alphanumeric hash value>"

when use <%= facebook_session.user.relationship_status %> , returns relationship status fine. similarly, <%= facebook_session.user.hometown_location.city %> returns city name fine.

i've checked out documentation facebooker, can't figure out correct way values need.

any idea on how work?
thanks!

facebook_session.user.education_history returns array of facebooker::educationinfo objects. proper way access be:

ed = facebook_session.user.education_history.last #will nil if not provided @ed_name = ed.name unless ed.nil? 

i not sure order sorted in, may need call .first instead of .last


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -