caching Twitter.screen_name makes Twitter::Client.new.user return old user #136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before Patch:
irb(main):001:0> at1 = AccessToken.find(3)
=> #<AccessToken id: 3, secret: "p4EOngHwWi4MsCSy92MgfvV8wgNoyVVTCgLAylKWmas", token: "236155797-kWLr6T5MZdPGmTX2hnQEKHMQEn72tNUlxOyuFDRc", user_id: 7, token_type: "twitter", created_at: "2011-01-09 23:09:24", updated_at: "2011-01-09 23:09:24">
irb(main):002:0> at2 = AccessToken.find(5)
=> #<AccessToken id: 5, secret: "1XZy36MSF1TVlycNHwOhU6hLKCiTKBSQgYZ6yunB0", token: "44006917-TEcF5y8Bj4sWls1Bt8mN3lFISbjK6COJmwIPZnutY", user_id: 10, token_type: "twitter", created_at: "2011-01-16 15:24:16", updated_at: "2011-01-16 15:24:16">
irb(main):003:0> Twitter::Client.new(:oauth_token => at1.token, :oauth_token_secret => at1.secret).user.screen_name
=> "bostontoastm"
irb(main):004:0> Twitter::Client.new(:oauth_token => at2.token, :oauth_token_secret => at2.secret).user.screen_name
=> "bostontoastm"
After Patch:
irb(main):001:0> at1 = AccessToken.find(3)
=> #<AccessToken id: 3, secret: "p4EOngHwWi4MsCSy92MgfvV8wgNoyVVTCgLAylKWmas", token: "236155797-kWLr6T5MZdPGmTX2hnQEKHMQEn72tNUlxOyuFDRc", user_id: 7, token_type: "twitter", created_at: "2011-01-09 23:09:24", updated_at: "2011-01-09 23:09:24">
irb(main):002:0> at2 = AccessToken.find(5)
=> #<AccessToken id: 5, secret: "1XZy36MSF1TVlycNHwOhU6hLKCiTKBSQgYZ6yunB0", token: "44006917-TEcF5y8Bj4sWls1Bt8mN3lFISbjK6COJmwIPZnutY", user_id: 10, token_type: "twitter", created_at: "2011-01-16 15:24:16", updated_at: "2011-01-16 15:24:16">
irb(main):003:0> Twitter::Client.new(:oauth_token => at1.token, :oauth_token_secret => at1.secret).user.screen_name
=> "bostontoastm"
irb(main):004:0> Twitter::Client.new(:oauth_token => at2.token, :oauth_token_secret => at2.secret).user.screen_name
=> "KenMazaika"