-1

I am developing an application using rails 3.2.0 and ruby 1.9 on a Mac
I have a very strange error when rendering an index view
Rails is rendering the characters us at the bottom of the screen, below an index table, and I cannot find these characters in the view.
This part of the view looks like

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

The part from id=content is yield in a layout file

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

When I delete the content of the view template, i.e the the us is still there
When I delete <%= yield %> in the layout, the us disappears
When I search for the us in the view code it is not found
When I add my own extra characters in the bottom of the view template code, after tags the us is displayed after these characters
When I delete the layout template the us is still there
The only thing I can come up with is that us is generated by the yield function in some mysterious way, but that seems as a very strange explanation!
Anyone that has had this problem before?
Anyone that know how to find extra characters as us in the code ?
Could it be a bug in the rendering engine ?
Any advices would be great appreciated

Here follows my view code. I use tableastic gem and some other gems

<% if !@unit.nil? 
  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)*@per_page+@per_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>
4

1 回答 1

0

我认为“我们”是js写的。也许你可以仔细检查js。

于 2013-04-11T07:49:19.157 回答