好吧,所以我剛剛拿起了紅寶石昨天..該應用程序,我做了跟蹤推文,並將它們存儲在一個數組中,並應輸出到網頁,但我不知道正確的語法輸出到終端,而不是HTML文件
輸出剛剛在終端中運行。 HTML
<h1>Posts#index</h1>
<p>Find me in app/views/posts/index.html.erb</p>
<%= @a %>
紅寶石
class PostsController < ApplicationController
TWITTER_COMSUMER_KEY = ""
TWITTER_CONSUMER_SECRET = ""
TWITTER_OATH_TOKEN = ""
TWITTER_OATH_TOKEN_SECRET = ""
def index
@a = Array.new(500)
TweetStream.configure do |config|
config.consumer_key = TWITTER_COMSUMER_KEY
config.consumer_secret = TWITTER_CONSUMER_SECRET
config.oauth_token = TWITTER_OATH_TOKEN
config.oauth_token_secret = TWITTER_OATH_TOKEN_SECRET
end
i = 0
TweetStream.track('weed') do |status|
temp = status.text
if(temp.include? "http")
a[i] = status.text
puts "#{status.text}"
i = i+1
end
end
end
end
請顯示一些代碼? – CuriousMind 2013-03-10 07:26:51
我希望那些鑰匙不是真的... – 2013-03-10 07:31:42
真棒,謝謝,我重置訪問btw – Greg 2013-03-10 07:33:32