Session bug using facebook-connect-with-authlogic in Rails
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_user
method 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.
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!
精彩评论