Module: Devise::Models::DeviseOauth2FbCanvas::ClassMethods

Defined in:
lib/devise_oauth2_fb_canvas/model.rb

Instance Method Summary collapse

Instance Method Details

#create_with_facebook_user(fb_user, token) ⇒ Object



36
37
38
39
40
41
# File 'lib/devise_oauth2_fb_canvas/model.rb', line 36

def create_with_facebook_user(fb_user, token)
  user = new(facebook_uid_field.to_sym => fb_user.id, :password => "fakepass", :password_confirmation => "fakepass")
  user.skip_confirmation! if user.respond_to?(:skip_confirmation!)
  user.do_update_facebook_user(fb_user, token)
  user
end

#find_with_facebook_user(fb_user, token) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/devise_oauth2_fb_canvas/model.rb', line 28

def find_with_facebook_user(fb_user, token)
  user = where(facebook_uid_field.to_sym => fb_user.id).first || where(:email => fb_user.email.downcase).first
  if user
    user.do_update_facebook_user(fb_user, token)
  end
  user
end