I am reading the book Facebook Platform Development in order to try to
code a small game for Facebook, and I have come across a "little"
problem: I am trying to insert a user every time this is logged, into a
database in my computer. I am using a couple of methods written in the
book, but there seems to be a couple of problems:
I can't seem to retrieve the session_key from Facebook using the
Facebooker helpers for RoR, and thus this value is null into the table
in my database.
Every time I reload the webpage, I can see that even though the
facebook_id is the same, the same user is added in another row to my
table in the database, even though it shouldn't; it's just supposed to
update the attribute session_key if this changes -anyway, right now this
These are the three methods I am using in order to perform all this:
user = User.find_or_create_by_facebook_id(facebook_id)
if self.session_key != session_key
# Re-create a Facebooker::Session object outside a request
@facebook_session ||= returning Facebooker::Session.create do
# Facebook sessions are good for only one hour storing
Thanks a lot in advance to everybody!