2013-04-11 49 views
-1

我使用的鐵軌3.2.0和MAC
上Ruby 1.9的我有一個很奇怪的錯誤渲染索引視圖
Rails的是在屏幕的底部呈現的人物我們開發應用程序時,下面的索引表,我無法在視圖中找到這些字符。
視圖的這一部分看起來像在視圖中渲染的額外字符無法找到!渲染引擎中可能存在的錯誤?

<section id="main"> 
<section id="group"></section> 
<section id="content"> 
<section id="data_table_section"> 
<script> 
us 
</section> 
</section> 

的一部分從ID =內容是產量在佈局文件

<section id='content'> 
    <%= yield %> 
</section> 

當我刪除視圖模板的內容,即在我們仍然存在
當我在佈局中刪除<%= yield%>時,us消失
當我搜索在我們在未找到該
當我添加自己多餘的字符在視圖模板代碼底部時,這些字符後顯示我們標籤後
當我刪除佈局模板視圖代碼我們仍然存在
我能想出的唯一的事情是,我們是由產量函數以某種神祕的方式產生的,但這似乎是一個非常奇怪的解釋!
以前有過這個問題的人嗎?
任何知道如何在代碼中查找額外字符的人?
它可能是渲染引擎中的錯誤嗎?
任何建議將不勝感激

下面我的觀點代碼。我使用砂岩寶石和其他一些寶石

<% if [email protected]? 
    header_text="Deltagarlista för #{@unit.class.model_name.human} #{@unit.name}" 
    else header_text='Deltagarlista för ST-Forum' 
end %> 

<section id='data_table_section'> 
<article id='remote_clinic_article'></article> 
<article id="users_article"> 
<%= table_for(@users) do |t| %> 
<thead ><tr ><th id='table_header' colspan=17><%=header_text%></th></tr></thead> 
<thead><tr style='text-align:center;' ><th colspan=15><%= render :partial=>'users/filter'%></th></tr></thead> 
<% index=(params[:page].to_i-1)*@per_page%> 
<%= t.data do 
    t.cell(:id, :heading => "Id") {|p| index+=1} 
    t.cell(:portrait, :heading => "Foto") {|p| image_tag(p.portrait_image,:height=>'24px')} 
    t.cell(:name,:heading => sort_to("Namn",users_url(:sort_field=>'surname', :sort=>@sort),@sort_field)) {|p| link_to(mark_search_hits(p.name,@search),user_path(p.id))} 
    t.cell(:clinic, :heading => sort_to("Arbetsplats",users_url(:sort_field=>'clinics.name', :sort=>@sort),@sort_field)) {|p| link_to(mark_search_hits(p.clinic.name,@search),clinic_path(p.clinic.id)) unless p.clinic.nil?} 
    t.cell(:email,:cell_html => {:class => "address"}, 
      :heading => sort_to("Email",users_url(:sort_field=>'email', :sort=>@sort),@sort_field)) {|p| mail_to(mark_search_hits(truncate(p.email,:length =>20),@search))} 
    t.cell(:user_roles,:cell_html => {:style => "width:50px"}, 
      :heading => sort_to("Roller",users_url(:sort_field=>'user_roles.role_index', :sort=>@sort),@sort_field)) {|p| mark_search_hits(p.roles(true).to_sentence,@search)} 
    t.cell(:groups, :heading => sort_to("Grupper",users_url(:sort_field=>'groups.name', :sort=>@sort),@sort_field)) {|p| mark_search_hits(to_sentence(p.groups),@search)} 
    t.cell(:forum, :heading => sort_to("ST-forum",users_url(:sort_field=>'forums.name', :sort=>@sort),@sort_field)) {|p| mark_search_hits(link_to(p.forum.name,clinic_path(p.forum.id)),@search) unless p.forum.nil?} 

    t.cell(:st_starts_on, :heading => sort_to("ST-start -- slut",users_url(:sort_field=>'employments.st_starts_on', :sort=>@sort),@sort_field)){|p| mark_search_hits(between_user_dates(p.employment.st_starts_on,p.employment.st_end_on),@search) unless p.employment.nil?} 
    t.cell(:legitimation_on,:heading => sort_to("Legitimation",users_url(:sort_field=>'employments.legitimation_on', :sort=>@sort),@sort_field)){|p| mark_search_hits(to_user_date(p.employment.legitimation_on),@search) unless p.employment.nil?} 
    t.cell(:employed_on, 
      :heading => sort_to("ST-kontrakt",users_url(:sort_field=>'employments.employed_on', :sort=>@sort),@sort_field)){|p| mark_search_hits(to_user_date(p.employment.employed_on),@search) unless p.employment.nil?} 
    t.cell(:last_visit, 
      :heading => sort_to("Inloggad senast",users_url(:sort_field=>'last_visit_at', :sort=>@sort),@sort_field)){|p| mark_search_hits(to_user_date(p.last_visit_at),@search) }              
    t.cell(:mail, 
      :heading => "Handledare/Handledd") {|p| if !p.supervisors.blank? then mail_supervisors(p) elsif !p.supervised.blank? then mail_supervised(p) end} 
    t.cell(:id, :cell_html => {:style => "width:30px"},:heading=>image_to('new.png',new_user_path,:class=>'no_class')) {|p| (image_to('destroy.png',user_path(p),:class=>'none',:method=>'delete', :id=>'destroy_button', :confirm => "Vill du verkligen radera vald kurs ",:title=>'Radera kurs')+' '+image_to('map.png', map_address_path(p.address.id),:method=>:get,:class=>'none', :remote=>true, :title=>'Visa en karta över bostadsområdet')).html_safe} 

end%> 
<tfoot> 
    <tr > 
     <td colspan="16" class='flickr_pagination'><%= will_paginate @users, :container => true %><span class="table_filter_text"> 
      <% if @count_users==0 %> 
      <span class="table_filter_alert_text"> 
       <%=" Inga användare tillgänglig för #{put_filter(@filterparams)}".html_safe%> 
      </span> 
      <%else%>   
      <span class="table_footer_text">  
      <%="Visar användare "+((params[:page].to_i-1)*@per_page+1).to_s+" till "+([(params[:page].to_i-1)*@[email protected]_page,@count_users].min).to_s+" av #{@count_users.to_s} användare" .html_safe%> 
      <br/><%= "Med #{ put_filter(@filterparams)}".html_safe %> 
      </span> 
      <%end%>   
     </td> 

    </tr> 
</tfoot> 
    <% end %> 
</article> 
</section> 
<script> 
$(document).ready(function() { 
/* $('.pagination a').attr('data-remote', 'true');*/ 
jQuery(".best_in_place").best_in_place(); 
}); 

// Observe forum_field and filter group_options 
$(document).ready(function(){ 

$("#forum_id").live('change',function() { 
    var forum = ""; 
    forum=$("select#forum_id :selected").val() 
    if (forum=='') {forum=0} 
     jQuery.get('/users/'+forum+'/update_group_options', function(data){ 
       $("#group_div").html(data); 
      }) 
      return false; 
    }) 
    .change(); 

$("#county_council_id").live('change',function() { 
    var county_council = ""; 
    county_council=$("select#county_council_id :selected").val() 
    if (county_council=='') {county_council=0} 
    jQuery.get('/users/'+county_council+'/update_forum_options', function(data){ 
      $("#forum_div").html(data); 
     }) 
      return false; 
    }) 
    .change(); 

}); 
</script> 
+0

你能發佈你的索引視圖代碼嗎? – Zippie 2013-04-11 07:30:19

+0

js如何寫美國。我使用的JS中的哪些命令可以生成/打印文本。我只是通過刪除js代碼來測試你的建議,重新啓動服務器並顯示索引模板 - 美國仍然存在。 – Hans 2013-04-11 08:27:52

+0

或我會建議刪除代碼的一部分,並試圖看看問題出現在哪裏 – Zippie 2013-04-11 08:33:14

回答

0

我認爲「我們」是由js寫的。 可能你可以仔細檢查js。