comparison app/models/tweet.rb @ 177:3176bd0d3c2c

Correct casing check
author nanaya <me@nanaya.pro>
date Sat, 13 Oct 2018 00:48:05 +0900
parents 08cc4a4d8a5f
children 17461f7682a2
comparison
equal deleted inserted replaced
176:08cc4a4d8a5f 177:3176bd0d3c2c
61 raw = Rails.cache.fetch(cache_key, :expires_in => self.class.cache_expires_time) do 61 raw = Rails.cache.fetch(cache_key, :expires_in => self.class.cache_expires_time) do
62 client_try(:user, @twitter_id).tap do |data| 62 client_try(:user, @twitter_id).tap do |data|
63 if data[:result] == :ok 63 if data[:result] == :ok
64 user = data[:data] 64 user = data[:data]
65 65
66 if user.id != @twitter_id && user.screen_name.downcase != @twitter_id 66 if user.id != @twitter_id && user.screen_name.downcase != @twitter_id.try(:downcase)
67 throw "Wrong user data. Requested: #{@twitter_id}, got: #{user.id} (#{user.screen_name.printable})" 67 throw "Wrong user data. Requested: #{@twitter_id}, got: #{user.id} (#{user.screen_name.printable})"
68 end 68 end
69 end 69 end
70 end 70 end
71 end 71 end