我试图在我的twitter feed控制器中调用tweet.entities时出现以下错误.
私有方法`entities'被称为#Twitter :: Status:0x94d4bf4
我在代码中没有称为实体的方法,我甚至做了一个完整的文件搜索来检查.
我要么需要重命名对象的实体部分,要么以某种方式找到这个所谓的私有方法的位置或以某种方式环绕它.我的twitter_feeds控制器中的方法如下:
def hometimeline
@user = User.find(current_user.id)
tweets = @user.tweeting.user_timeline(count: '10', include_entities: true)
parsed_tweets = []
i = 0
tweets.each do |tweet|
more = Hash.new
more['test'] = tweet
internal_hash = Hash.new
mappings = {"source" => "fixed"}
another = more['test']
boo = Array(tweet)
#newhash = Hash[twee.map {|k, v| [mapping[k], v] }]
#newhash = Hash[more.map {|k, v| [mappings[k], v] }]
#newhash = Hash[tweet.map {|k, v| [mappings[k] || k, v] }]
internal_hash['parsed_text'] = tweet.entities
internal_hash['id'] = tweet.id
internal_hash['raw_text'] …Run Code Online (Sandbox Code Playgroud)