diff --git a/app/controllers/facebook_controller.rb b/app/controllers/facebook_controller.rb index a66308d2883..8963db95b93 100644 --- a/app/controllers/facebook_controller.rb +++ b/app/controllers/facebook_controller.rb @@ -109,7 +109,7 @@ class FacebookController < ApplicationController data, sig = Facebook.parse_signed_request(params[:signed_request]) if data && sig if @facebook_user_id = data['user_id'] - Shard.with_each_shard do + Shard.with_each_shard(UserService.associated_shards('facebook', @facebook_user_id)) do @service = UserService.find_by_service_and_service_user_id('facebook', @facebook_user_id) break if @service end @@ -130,7 +130,7 @@ class FacebookController < ApplicationController @service = @user.user_services.find_by_service('facebook') elsif session[:facebook_user_id] @facebook_user_id = session[:facebook_user_id] - Shard.with_each_shard do + Shard.with_each_shard(UserService.associated_shards('facebook', @facebook_user_id)) do @service = UserService.find_by_service_and_service_user_id('facebook', @facebook_user_id) break if @service end diff --git a/app/models/user_service.rb b/app/models/user_service.rb index 5f176df3bc6..3ef5eae3d6e 100644 --- a/app/models/user_service.rb +++ b/app/models/user_service.rb @@ -280,4 +280,8 @@ class UserService < ActiveRecord::Base end end def self.serialization_excludes; [:crypted_password, :password_salt, :token, :secret]; end + + def self.associated_shards(service, service_user_id) + [Shard.default] + end end