Skip to content

Commit 06f3f98

Browse files
committed
Update README.md
Update 6.1 Rails.
1 parent e06ea23 commit 06f3f98

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,7 @@ A Rails controller that allows a user to authorize their GitHub account and then
596596
```ruby
597597
class GithubController < ApplicationController
598598

599-
attr_accessor :github
600-
private :github
601-
602599
def authorize
603-
github = Github.new client_id: '...', client_secret: '...'
604600
address = github.authorize_url redirect_uri: 'http://...', scope: 'repo'
605601
redirect_to address
606602
end
@@ -610,6 +606,12 @@ class GithubController < ApplicationController
610606
access_token = github.get_token authorization_code
611607
access_token.token # => returns token value
612608
end
609+
610+
private
611+
612+
def github
613+
@github ||= Github.new client_id: '...', client_secret: '...'
614+
end
613615
end
614616
```
615617

0 commit comments

Comments
 (0)