Hi, I'm playing around with a clone of this Koala example app
https://github.com/banane/sample-koala-rails-app . However, the author of it doesn't save user data to a database. I'm trying to add that in.
I created this method on the User model which is invoked from the callback method. However, I'm getting this save error
undefined method `save!' for #<Class:0x00000100b51ea8>
Does anyone see what I'm doing wrong?
User.rb
def self.oath(access_token, graphdata)
name = graphdata[:name]
first_name = graphdata[:first_name]
last_name = graphdata[:last_name]
username = graphdata[:username]
gender = graphdata[:gender]
email = graphdata[:email]
access_token = access_token
save!
end
home_controller.rb (callback method)
def callback
if params[:code]
# acknowledge code and get access token from FB
session[:access_token] = session[:oauth].get_access_token(params[:code])
end
# auth established, now do a graph call:
@api = Koala::Facebook::API.new(session[:access_token])
begin
@user_info = @api.get_object("me")
@graph_data = @api.get_object("/me/statuses", "fields"=>"message")
rescue Exception=>ex
puts ex.message
end
user = User.oath(session[:access_token], @user_info)
respond_to do |format|
format.html { }
end
end