views:

100

answers:

1

Using Authlogic and Authlogic Facebook Connect.

before_filter works great. Get name and facbook_uid saved in db. Only problem is that it saves a new record every time.

Need help figuring out how to build some type of find_by_facebook_uid_or_create_user

I have tried reading up on the API's for facebooker, but this is way over me. :(

UPDATED -

user.rb

def before_connect(facebook_session)
   self.firstname = facebook_session.user.first_name
   self.lastname = facebook_session.user.last_name
   self.persistence_token = reset_persistence_token
end

application_controller.rb

before_filter :set_facebook_session
helper_method :facebook_session
A: 

For those that are having the problem that a new user is created every time they f-connect and are using MySql, change the facebook_uid from Int (integer) to BigInit (Big Integer).

Problem for me was that facebook was looking at long ID's and Int was truncating these ID's.

pcasa