File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -596,11 +596,7 @@ A Rails controller that allows a user to authorize their GitHub account and then
596
596
``` ruby
597
597
class GithubController < ApplicationController
598
598
599
- attr_accessor :github
600
- private :github
601
-
602
599
def authorize
603
- github = Github .new client_id: ' ...' , client_secret: ' ...'
604
600
address = github.authorize_url redirect_uri: ' http://...' , scope: ' repo'
605
601
redirect_to address
606
602
end
@@ -610,6 +606,12 @@ class GithubController < ApplicationController
610
606
access_token = github.get_token authorization_code
611
607
access_token.token # => returns token value
612
608
end
609
+
610
+ private
611
+
612
+ def github
613
+ @github ||= Github .new client_id: ' ...' , client_secret: ' ...'
614
+ end
613
615
end
614
616
```
615
617
You can’t perform that action at this time.
0 commit comments