views:

376

answers:

1

I'm trying to follow this article: http://ryanbigg.com/2010/03/testing-facebook, but I'm stuck. I think the problem is with my session, in that the current_usermethod comes up with nil for session[:facebook_session].

According to the original authlogic, it says to use the active_record_store for sessions:

# config/environment.rb
config.action_controller.session_store = :active_record_store
# db/schema includes
  create_table "sessions", :force => true do |t|
    t.string   "session_id", :null => false
    t.text     "data"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

The article calls for the use of cookies. I'm confused; can I use cookies and the active record sessions? I'm also confused by the use of cattr_accessor :current_user from within the User model -- current_user still goes in the application controller, right?

Please help.

+2  A: 

Hi there,

Yes you should be able to still use the cookies and sessions in harmony; Facebook sets & uses cookies (afaik) regardless of how your application's sessions are configured.

The cattr_accessor :current_user is used elsewhere in our application (for reasons I can't recall right now) and should really be left out of the post. Thanks for bringing it up! Yes, there should still be a current_user method in ApplicationController.

Apologies that it took so long to respond, you sent the Twitter message to me at 1am my time, I read it at 3am (due to somebody drumming next door) and I've been busy today up until now (4pm)! I sincerly hopes this helps and if you need more help I should be around for a while yet!

Ryan Bigg
I'm confused why session[:facebook_session] keeps coming up nil.
Jesse