Fix TwitterBot arguments (#634)

* Fix TwitterBot arguments

* Fix ::random_identity
This commit is contained in:
Ben Halpern 2018-07-30 10:51:10 -07:00 committed by GitHub
parent 1181a952ed
commit a3788dfbd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,11 +97,10 @@ class Tweet < ApplicationRecord
end
def self.random_identity
if Rails.env.production?
Identity.where(provider: "twitter").last(250).sample
else
Identity.where(provider: "twitter").last ||
{ token: ApplicationConfig["TWITTER_KEY"], secret: ApplicationConfig["TWITTER_SECRET"] }
end
iden = Identity.where(provider: "twitter").last(250).sample
{
token: iden&.token || ApplicationConfig["TWITTER_KEY"],
secret: iden&.secret || ApplicationConfig["TWITTER_SECRET"],
}
end
end