2011-12-21 3 views
0

나는 특정 해시 태그로 사용자의 트윗을 검색하기 위해 트위터 보석을 사용하고 있습니다. 이제 결과를 파싱하여 뷰에서 렌더링하고 싶지만 방법은 확실하지 않습니다. 이처럼 나에게 출력을 제공보기에서 파서 트위터 보석 출력

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 %> 각 트윗에 대한 사용자의 트위터 프로필. 나는 javascript에 xml로 이것을했지만 문제가있다.

답변

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

흠, 그래,이게 내가하고있는 일이지만 내 레일 서버가 망가 졌어. 그래서 나는 서버가 부서지는 것에 집중할 것입니다. 감사! – tvalent2

관련 문제