Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 975005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:30:59+00:00 2026-05-16T03:30:59+00:00

I am reading the book Facebook Platform Development in order to try to code

  • 0

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:

  1. 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.

  2. 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 is null.

These are the three methods I am using in order to perform all this:

def self.for(facebook_id,facebook_session=nil)
    user = User.find_or_create_by_facebook_id(facebook_id)
    unless facebook_session.nil?
      user.store_session(facebook_session.session_key)
    end
  end

  def store_session(session_key)
    if self.session_key != session_key
      update_attribute(:session_key, session_key)
    end
  end

  # Re-create a Facebooker::Session object outside a request
  def facebook_session
    @facebook_session ||= returning Facebooker::Session.create do |session|
      # Facebook sessions are good for only one hour storing
      session.secure_with!(session_key,facebook_id,1.hour.from_now)
    end
  end

Thanks a lot in advance to everybody!1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:30:59+00:00Added an answer on May 16, 2026 at 3:30 am

    Hey sadly facebook changes its API all the time!

    Make sure that the book is up to date and that none of the API has changed as of when the book was written. Also check that the gem is also up to date.

    I personally use http://github.com/chrisdinn/hyper-graph when dealing with facebook. It makes calls to the facebook graph (graph.facebook.com)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While reading a book on C#, I have come across code that uses the
I'm reading a book Crafting Rails Applications by Jose Valim and have come across
I am reading some book and I have encountered a piece of code that
Reading a book I have found the following statement: (Object) Behaviors answer either of
While reading a book about JavaScript I stumbled across an example: var names =
I'm reading the book 'Beginning F#', There's a short list for example code, to
I am reading a book in which author used a code like this public
I have started reading the book Essential Linux Device Drivers. I am following the
When reading a book for business objects, I came across the term- fact table
While reading a book, i came across this statement: The methods of an object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.