I am pulling a livestream of data and trying to format it as a table. I saw this post but I am having an odd issue. The table formatting ["</td>\n\t\t</tr>\n", "</td>\n\t\t</tr>\n",.......
shows up at the top of the page, above the table itself (which is correctly formatted). Can someone explain why this is?
<h1>Controller1#index</h1>
graphic started<br>
<%= line_chart( [1,2,3,4,5] ) %>
<br>graphic done
<%
term="google"
client = Twitter::REST::Client.new do |config|
config.consumer_key = "bi5rmrxr"
config.consumer_secret = "GVflzHe72OZp"
config.access_token = "263-SYURzb"
config.access_token_secret = "Spc9"
end
%>
<table class="table table-condensed">
<thead>
<td>screen name</td> <td>time created</td><td>times favorited</td><td>text</td>
</thead>
<%= client.search("#{term} -rt", lang: "en").take(100).collect do |tweet| %>
<tr>
<td><%= "#{tweet.user.screen_name}"%></td>
<td><%= "#{tweet.created_at}"%></td>
<td><%= "#{tweet.favorite_count}"%></td>
<td><%= "#{tweet.text}"%></td>
</tr>
<% end %>
</table>
you are printing client complete search as well which is being displayed at the top. you should not do not do. replace this
<%= client.search("#{term} -rt", lang: "en").take(100).collect do |tweet| %>
with this
<% client.search("#{term} -rt", lang: "en").take(100).collect do |tweet| %>