Skip to content

Commit

Permalink
Renamed Facebook::Session.graph_api to simply graph. Added a bit of d…
Browse files Browse the repository at this point in the history
…ocumentation
  • Loading branch information
thhermansen committed Jun 14, 2010
1 parent d26cc15 commit d4d8503
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.rdoc
Expand Up @@ -114,6 +114,18 @@ Note that this is only relevant if devise's configuration value facebook_auto_cr
the user is as a default saved without running validations meaning that you should implement a before_create_by_facebook function and extract
what you can like email etc from the facebook_session. You can override this though via configuration key 'run_validations_when_creating_facebook_user'.

==== Simple example on how to extract user's data from Facebook
class User < ActiveRecord::Base
before_create_by_facebook :extract_user_data_from_facebook_session

def extract_user_data_from_facebook_session
# The following code returns hash with information about current user being created
# For more information, see Koala gem documentation http://wiki.github.com/arsduo/koala/graph-api
user_data_from_facebook = facebook_session.graph.get_object(:me)
# Assign attributes with fetched data..
end
end

=== before/after/around connecting_to_facebook

These are called when Devise authenticates the user via facebook connect. In effect the user will be connected to facebook
Expand Down
2 changes: 1 addition & 1 deletion lib/devise_facebook_open_graph/facebook/session.rb
Expand Up @@ -28,7 +28,7 @@ def cookie_content
#
# Gives access to query as user with an oauth access token fetched from the cookie content
#
def graph_api
def graph
Koala::Facebook::GraphAPI.new(access_token)
end

Expand Down

0 comments on commit d4d8503

Please sign in to comment.