2011-12-21 4 views
0

私はTwitterの宝石を使って特定のハッシュタグでユーザーのつぶやきを検索しています。今私は、出力を解析し、ビューでレンダリングしたいが、どのように確かではありません。私は、次のコントローラのアクションの働きを持っている:パースツイッターgemの出力を表示

def profile_hustle 
    @profile = Profile.find(params[:id]) 
    @profile_tweets = Twitter.search("#hashtag from:#{@profile.twitter}") 
end 

これは私のように出力できます:

[#<Twitter::Status:0x007fbf331aec40 @attrs={"created_at"=>"Wed, 21 Dec 2011 04:18:39 +0000", "from_user"=>"username", "from_user_id"=>userid, "from_user_id_str"=>"userid", "from_user_name"=>"User Name", "geo"=>nil, "id"=>otherid, "id_str"=>"otherid", "iso_language_code"=>"fr", "metadata"=>{"result_type"=>"recent"}, "profile_image_url"=>"http://a3.twimg.com/profile_images/user/Screen_shot_2009-09-23_at_11.39.35_PM_normal.jpg", "profile_image_url_https"=>"https://si0.twimg.com/profile_images/user/Screen_shot_2009-09-23_at_11.39.35_PM_normal.jpg", "source"=>"&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;", "text"=>"Test 2 #hashtag", "to_user"=>nil, "to_user_id"=>nil, "to_user_id_str"=>nil, "to_user_name"=>nil}>, #<Twitter::Status:0x007fbf331aebf0 @attrs={"created_at"=>"Wed, 21 Dec 2011 04:12:27 +0000", "from_user"=>"username", "from_user_id"=>userid, "from_user_id_str"=>"userid", "from_user_name"=>"User Name", "geo"=>nil, "id"=>149341436104544258, "id_str"=>"149341436104544258", "iso_language_code"=>"fr", "metadata"=>{"result_type"=>"recent"}, "profile_image_url"=>"http://a3.twimg.com/profile_images/user/Screen_shot_2009-09-23_at_11.39.35_PM_normal.jpg", "profile_image_url_https"=>"https://si0.twimg.com/profile_images/user/Screen_shot_2009-09-23_at_11.39.35_PM_normal.jpg", "source"=>"&lt;a href=&quot;http://twitter.com/&quot;&gt;web&lt;/a&gt;", "text"=>"Test #hashtag", "to_user"=>nil, "to_user_id"=>nil, "to_user_id_str"=>nil, "to_user_name"=>nil}>] 

私はテキストを表示するビューでレンダリングすると、可能であれば<% =のlink_to%>を各ツイートのユーザーのTwitterプロファイル私はjavascriptにxmlでこれをしましたが、これに問題があります。

答えて

0
<% @profile_tweets.each do |tweet| %> 
    <%= link_to tweet.text, "http://twitter.com/#{tweet.from_user}" %> 
<% end %> 
+0

私はそれをやっていましたが、それは私のレールサーバをクラッシュさせていました。だから私はサーバーのクラッシュに焦点を当てます。ありがとう! – tvalent2

関連する問題