Replace try with safe navigation operator (#3988) [ci skip]

This commit is contained in:
Jacob Herrington 2019-09-11 15:16:37 -05:00 committed by Mac Siri
parent 653a266141
commit b00505e9f4

View file

@ -73,7 +73,7 @@ class Tweet < ApplicationRecord
tweet = Tweet.where(twitter_id_code: tweeted.attrs[:id_str]).first_or_initialize
tweet.twitter_uid = tweeted.user.id.to_s
tweet.twitter_username = tweeted.user.screen_name.downcase
tweet.user_id = User.find_by(twitter_username: tweeted.user.screen_name).try(:id)
tweet.user_id = User.find_by(twitter_username: tweeted.user.screen_name)&.id
tweet.favorite_count = tweeted.favorite_count
tweet.retweet_count = tweeted.retweet_count
tweet.in_reply_to_user_id_code = tweeted.attrs[:in_reply_to_user_id_str]