2012-05-01 41 views
2

我不斷收到此錯誤:

Showing app/views/posts/index.html.haml where line #115 raised: 

app/views/posts/index.html.haml:115: syntax error, unexpected keyword_ensure, 
expecting $end 

Extracted source (around line #115): 

0 

Trace of template inclusion: app/views/posts/index.html.haml 

Application Trace | Framework Trace | Full Trace 

app/controllers/posts_controller.rb:28:in `index' 

這是index.html.haml文件:

.container-fluid 
%br 
.row-fluid 
    .span3 
     .well.sidebar-nav{:style=>'background-color:rgb(999,999,999);'} 
      %ul.nav.nav-pills.nav-stacked 
       %li 
        %a{:href => '#'} Todays Best 
       %li 
        %a{:href => '#'} Yesterdays Best 
       %li 
        %a{:href => '#'} Weeks Best 
       %li 
        %a{:href => '#'} Months Best 
       %li 
        %a{:href => '#'} Hall of Fame 
     .label.label-inverse 
      %center 
       Todays Best: 
     %table.table.table-bordered.table-condensed{:style=>'background-color:rgb(999,999,999);'} 
      - @count= 0 
      - @feedcount= 4 #5 best 
      - @popularfeed.each do |post| 
       - if @count<[email protected] then 
        %tr 
         %td 
          %center 
           = truncate(post.content, :length => 132) 
           - @count= @count +1 
           %br 
          %p{:align => "right"} 
           %span{:style=>'color:green;'}=post.likes 
           %span{:style=>'color:red;'}=post.dislikes 
           %span{:style=>'color:blue;'}=post.prominence 
    .span6 
     %center 
      %table.table.table-bordered.table-condensed{:style=>'background-color:rgb(999,999,999);'} 
      - @mainfeed.each do |post| 
       =link_to post do 
        %tr 
         %td 
          %center 
           %br 
           =post.content 
          %p.small{:align => 'right'} 
           3 days ago 
          %center 



           %span.labelStyle.label.label-success 
            =link_to 'Agree', :action => 'like', :id => post.id 
            =post.likes 
           %span.label.label-important.postbar 
            =link_to 'Disagree', :action => 'dislike', :id => post.id 
            =post.dislikes 
           %span.label.label-info.postbar 
            =link_to 'Voice', :action => 'prominence', :id => post.id 
            =post.prominence 
           %span.label.postbar 
            %a{:'data-toggle'=>"modal", :'data-target'=>"#myModal"} 
             Comments 
             =post.comments.count 

           %span.label.postbar 
            Report 
           %br 
           %br 
           %tr 
        %td 
         %p 
          %a.btn{:href => '#'} View details &raquo; 
    .span3 
     .well{:style=>'background-color:rgb(999,999,999);'} 
      =render 'form' 
     -# .alert.alert-success 
     -#  Post was succesfully made. 
    .span3 
     .label.label-inverse 
      %center Most Controversial:     
     %table.table.table-bordered.table-condensed{:style=>'background-color:rgb(999,999,999);'} 
      - @count= 0    
      - @feedcount= 3 #3 best 
      - @controfeed.each do |post| 
       - if @count<[email protected] then 
        %tr         
         %td          
          %center           
           =truncate(post.content, :length => 132)    
           [email protected]= @count +1 
           %br              
          %p{:align => "right"} 
           %span{:style=>'color:green;'}=post.likes    
           %span{:style=>'color:red;'}=post.dislikes  
           %span{:style=>'color:blue;'}=post.prominence 

我相信錯誤應該在.span6中,但我不確定。這個文件只有112行長,錯誤是在行115.幫助表示讚賞

+1

代碼看起來OK。將它切成兩半,找出有錯誤的行。然後再砍一次,直到找到確切的地方。 – ujifgc

回答

2

你有兩個評論(或至少,我認爲你在評論你的代碼)在116和177沒有前綴-

#3 best#5 best可能需要成爲-#3best-#5best

相關問題