Fixed elasticsearch index issue by replace Twitter::NullObject with nil.
This commit is contained in:
parent
0b54d60e4f
commit
e9efae4b83
2 changed files with 3 additions and 3 deletions
|
@ -10,11 +10,11 @@ class TweetBase
|
||||||
def user(tweet)
|
def user(tweet)
|
||||||
|
|
||||||
if tweet.class == Twitter::DirectMessage
|
if tweet.class == Twitter::DirectMessage
|
||||||
Rails.logger.error "Twitter sender for dm (#{tweet.id}): found"
|
Rails.logger.debug "Twitter sender for dm (#{tweet.id}): found"
|
||||||
Rails.logger.debug tweet.sender.inspect
|
Rails.logger.debug tweet.sender.inspect
|
||||||
return tweet.sender
|
return tweet.sender
|
||||||
elsif tweet.class == Twitter::Tweet
|
elsif tweet.class == Twitter::Tweet
|
||||||
Rails.logger.error "Twitter sender for tweet (#{tweet.id}): found"
|
Rails.logger.debug "Twitter sender for tweet (#{tweet.id}): found"
|
||||||
Rails.logger.debug tweet.user.inspect
|
Rails.logger.debug tweet.user.inspect
|
||||||
return tweet.user
|
return tweet.user
|
||||||
else
|
else
|
||||||
|
@ -377,7 +377,7 @@ class TweetBase
|
||||||
|
|
||||||
# replace Twitter::NullObject with nill to prevent elasticsearch index issue
|
# replace Twitter::NullObject with nill to prevent elasticsearch index issue
|
||||||
preferences.each { |_key, value|
|
preferences.each { |_key, value|
|
||||||
next if value.class != ActiveSupport::HashWithIndifferentAccess
|
next if value.class != ActiveSupport::HashWithIndifferentAccess && value.class != Hash
|
||||||
value.each { |sub_key, sub_level|
|
value.each { |sub_key, sub_level|
|
||||||
next if sub_level.class != Twitter::NullObject
|
next if sub_level.class != Twitter::NullObject
|
||||||
value[sub_key] = nil
|
value[sub_key] = nil
|
||||||
|
|
Loading…
Reference in a new issue