118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
# File 'lib/rplatform_rails/model_extensions.rb', line 118
def find_or_create_by_facebook_session(options={})
RAILS_DEFAULT_LOGGER.info "** RFACEBOOK DEPRECATION WARNING: acts_as_facebook_user will probably be deprecated in a future version of the RFacebook plugin"
if options.is_a?(RPlatform::FacebookWebSession)
fbsession = options
options = {}
else
fbsession = options[:facebook_session]
end
unless fbsession.is_a?(Rplatform::FacebookWebSession)
RAILS_DEFAULT_LOGGER.debug "** RFACEBOOK INFO: find_or_create_by_facebook_session needs a :facebook_session specified"
return nil
end
if fbsession.ready?
instance = find_by_facebook_uid(fbsession.session_user_id) || self.new(options)
instance.facebook_session = fbsession
if !instance.save
RAILS_DEFAULT_LOGGER.debug "** RFACEBOOK INFO: failed to update or create the Facebook user object in the database"
return nil
end
return instance
else
RAILS_DEFAULT_LOGGER.info "** RFACEBOOK WARNING: tried to use an inactive session for acts_as_facebook_user (in find_or_create_by_facebook_session)"
return nil
end
end
|