Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callbacks not working for me (MongoMapper) #13

Closed
bitzesty opened this issue Dec 26, 2009 · 9 comments
Closed

callbacks not working for me (MongoMapper) #13

bitzesty opened this issue Dec 26, 2009 · 9 comments

Comments

@bitzesty
Copy link

here is my call back, tried a before_fb_connect but still nothing is set. will try and build a bare bones app to demonstrate the prob.

def after_facebook_connect(fb_session)

  # Just fetch what we really need from Facebook...
  fb_session.user.populate(:locale, :current_location, :username, :name,
                            :first_name, :last_name, :birthday_date, :sex,
                            :city, :state, :country, :relationship_status, :proxied_email)

  self.birthdate      = fb_session.user.birthday_date.try(:to_date)
  self.city           = fb_session.user.hometown_location.try(:city)
  self.country        = fb_session.user.hometown_location.try(:country)
  self.first_name     = fb_session.user.first_name
  self.gender         = fb_session.user.sex
  self.last_name      = fb_session.user.last_name
  self.locale         = fb_session.user.locale
  self.real_name      = fb_session.user.name
  self.relationship_status = fb_session.user.relationship_status    
  self.time_zone      = fb_session.user.current_location.try(:city)
  self.username       = fb_session.user.username
  self.zip_code       = fb_session.user.hometown_location.try(:state)
  self.proxied_email  = fb_session.user.proxied_email

  self.save
end
@grimen
Copy link
Owner

grimen commented Dec 26, 2009

OK, I'm not running MongoDB locally. Yes, please let me know when you got something to test out.

@bitzesty
Copy link
Author

i've got no idea why this isn't working, but I have a hack - assigning the fb session value to a random variable then to the user attribute works:

 _x = fb_session.user.name
 self.real_name = _x 

@grimen
Copy link
Owner

grimen commented Dec 31, 2009

=o That's weird...but I'm 99.9% sure that's not because of this plugin. Sounds like Facebooker magic. Let me know if you find out why please.

@bitzesty
Copy link
Author

facebooker lazy loading or something very weird

@bitzesty
Copy link
Author

solved it need to call to_s on facebooker atts on the user object or they will not be saved

@grimen
Copy link
Owner

grimen commented Dec 31, 2009

Could you elaborate what you mean with a sample?

@bitzesty
Copy link
Author

  self.username       = fb_session.user.username.to_s
  self.real_name      = fb_session.user.name.to_s

as opposed to

  self.username       = fb_session.user.username
  self.real_name      = fb_session.user.name

otherwise atlease with mongomapper - it saves nil

@grimen
Copy link
Owner

grimen commented Jan 7, 2010

Could you reproduce this in a test-app? Easier to report errors in Facebooker mailing list in such case; I asked about this but no-one there seems to see the problem.

@bitzesty
Copy link
Author

bitzesty commented Jun 9, 2010

its probably a mongomapper issue - closing

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant