I'm really struggling to find some information about extracting
relevant information from my hash output from twitter.
My model contains:
def timeline
@timeline = client.home_timeline
end
And my view:
<%= @user.twitter_token.timeline.each do |t| %>
<%= t.text %>
<br>
<% end %>
I was hoping to extract just my text from the hashie but it doesn't
quite work... I get my tweets on separate lines which is great,
followed by the hash again...
[<#Hashie::Mash contributors=nil coordinates=nil created_at="Wed May
04 18:57:32 +0000 2011" favorited=false geo=nil id=65852579048980480
id_str="65852579048980480" in_reply_to_screen_name=nil
in_reply_to_status_id=nil in_reply_to_status_id_str=nil
in_reply_to_user_id=nil in_reply_to_user_id_str=nil place=nil
retweet_count=0 retweeted=false source="web" text="what's happening?"
truncated=false user= ...
How on earth can I stop this?!
Thanks,
Simon
I'm really struggling to find some information about extracting
relevant information from my hash output from twitter.
My model contains:
def timeline
@timeline = client.home_timeline
end
And my view:
<%= @user.twitter_token.timeline.each do |t| %>
Don't use <%= here - it will dump the result of the expression (which
in the case of .each is the entire collection that was iterated over)
into the view, which isn't what you want
Fred
Hi
Many thanks for the response. I've changed my view to this and I now
can't see the recent tweets but am left with the hash still. Why am I
finding this so complicated!?!
<%= @user.twitter_token.timeline.each do |t| %>
<% t.text %>
<br>
<% end %>
Simon
Hi
Many thanks for the response. I've changed my view to this and I now
can't see the recent tweets but am left with the hash still. Why am I
finding this so complicated!?!
You removed the wrong equals
Fred
Ah. Got it by removing the = from the first statement…
Sorry, didn't see this!
Thanks for the help.
Am now stuck on sorting foursquare's hashie out. Seems like the same format but I get nothing out of the hash when I do this:
<% @user.foursquare_token.checkins.each do |c| %>
<%= c.display %>
<% end %>
Seems a bit illogical...
[<#Hashie::Mash created="Thu, 12 May 11 12:53:30 +0000" display="xxx xxx S. @ Buspace Studio" id=634678877 .....
Shouldn't that output: xxx xxx
Thanks again
Simon
BTW. It does seem to work when I do:
<%= c.created %>
Outputs: History: Thu, 12 May 11 12:53:30 +0000