-
-
Save FeipingHunag/4204450 to your computer and use it in GitHub Desktop.
Revisions
-
Evan David Light revised this gist
Nov 25, 2011 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,9 +19,14 @@ def provision_with!(user_info, extra_user_hash) class SessionController < ApplicationController def create user = User.new provisioner = GitHubUserProvisioner.new(user) provisioner.provision_with!(*yank_oauth_stuff_off_request) end private def yank_oauth_stuff_off_request # ... end end -
Evan David Light revised this gist
Nov 25, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,7 @@ def provision_with!(user_info, extra_user_hash) class SessionController < ApplicationController def create user_info, extra_user_hash = yank_oauth_stuff_off_request user = User.new provisioner = GitHubUserProvisioner.new(user) provisioner.provision_with!(user_info, extra_user_hash) -
Evan David Light revised this gist
Nov 25, 2011 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,14 +3,15 @@ class User < ActiveRecord::Base end class GitHubUserProvisioner < SimpleDelegator def provision_with!(user_info, extra_user_hash) self.github_login = extra_user_hash['login'] self.name = user_info['name'] self.email = user_info['email'] self.github_url = user_info['urls']['GitHub'] self.blog_url = user_info['urls']['Blog'] self.gravatar_id = extra_user_hash['gravatar_id'] self.location = extra_user_hash['location'] save! end end @@ -20,7 +21,6 @@ class SessionController < ApplicationController def create user = User.new provisioner = GitHubUserProvisioner.new(user) provisioner.provision_with!(user_info, extra_user_hash) end end -
Evan David Light revised this gist
Nov 25, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def provision_with(user_info, extra_user_hash) class SessionController < ApplicationController def create user = User.new provisioner = GitHubUserProvisioner.new(user) provisioner.provision_with(user_info, extra_user_hash) provisioner.save! end -
Evan David Light created this gist
Nov 25, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ class User < ActiveRecord::Base # ... lots of persistence stuff end class GitHubUserProvisioner < SimpleDelegator def provision_with(user_info, extra_user_hash) self.github_login = extra_user_hash['login'] self.name = user_info['name'] self.email = user_info['email'] self.github_url = user_info['urls']['GitHub'] self.blog_url = user_info['urls']['Blog'] self.gravatar_id = extra_user_hash['gravatar_id'] self.location = extra_user_hash['location'] end end # And, say, in your SessionController in your controller action class SessionController < ApplicationController def create user = User.new provisioner = GitHubUserProvisioner.new(@user) provisioner.provision_with(user_info, extra_user_hash) provisioner.save! end end