2013-08-23 39 views
0

在我的Rails應用程序的最終視圖中,我需要顯示數百條記錄。當我看到我的輸出時,我看到它逐漸向中心滑動,並且完全向右緩慢滑動。我嘗試左對齊,但它不工作。軌道上的紅寶石視圖模板

<%= will_paginate @tweets %> 
<% @tweets.each do |tweets| %> 
<ul> 
    <li><%= tweets.id %></li> 
    <li><%= tweets.tweet_created_at %></li> 
    <li><%= tweets.tweet_text %></li> 
    <li><%= tweets.user_id %></li> 
    <li><%= tweets.user_name %></li>  
    <li><%= tweets.user_loc %></li> 
    <li><%= tweets.user_img %></li> 
    <li><%= tweets.longitude %></li> 
    <li><%= tweets.latitude %></li> 
    <li><%= tweets.place %></li> 
    <li><%= tweets.country %></li> 
<% end %> 
</ul> 

當我需要顯示大量記錄時,它完全滑動到屏幕的右端。如何解決這個問題?

+0

我不知道你爲什麼這個標籤Ruby和Ruby on Rails的。你必須使用CSS來解決這個問題。也許你可以加入一張顯示問題的屏幕截圖,因爲從你的描述中可以確切地知道你的意思。 – Mischa

回答

1

我認爲它應該是從下面的任一個two options.
UL標記沒有正確結束。

選項1:

<%= will_paginate @tweets %> 
<% @tweets.each do |tweets| %> 
<ul> 
    <li><%= tweets.id %></li> 
    <li><%= tweets.tweet_created_at %></li> 
    <li><%= tweets.tweet_text %></li> 
    <li><%= tweets.user_id %></li> 
    <li><%= tweets.user_name %></li>  
    <li><%= tweets.user_loc %></li> 
    <li><%= tweets.user_img %></li> 
    <li><%= tweets.longitude %></li> 
    <li><%= tweets.latitude %></li> 
    <li><%= tweets.place %></li> 
    <li><%= tweets.country %></li> 
</ul> 
<% end %> 

或選項2

<%= will_paginate @tweets %> 
    <ul> 
    <% @tweets.each do |tweets| %> 
     <li><%= tweets.id %></li> 
     <li><%= tweets.tweet_created_at %></li> 
     <li><%= tweets.tweet_text %></li> 
     <li><%= tweets.user_id %></li> 
     <li><%= tweets.user_name %></li>  
     <li><%= tweets.user_loc %></li> 
     <li><%= tweets.user_img %></li> 
     <li><%= tweets.longitude %></li> 
     <li><%= tweets.latitude %></li> 
     <li><%= tweets.place %></li> 
     <li><%= tweets.country %></li> 
    <% end %> 
    </ul> 
+0

非常感謝我得到了輸出的第一個選項 – user2492854