2014-04-14 51 views
0

在我看來,我有:語法錯誤,意外 ')',希望 '=' ... icipant.username,參與者); @ output_buffer.safe_append =」

<% @conversations.each do |conversation| %> 

<% if participant != current_user %> 
    <%= participant.username, participant %> 
<% end %> 


<%= link_to conversation.subject, conversation %> 
<%= conversation.updated_at.strftime("%a, %m/%e/%Y %I:%M %p") %> 
<%= link_to "Move to Trash", {:controller => "conversations", :action => "trash", :id => conversation.id}, :title=> "Move to Trash", :method=>'post' %> 
<% end %> 

我得到上面的錯誤,但當我刪除

<% if participant != current_user %> 
    <%= participant.username, participant %> 
<% end %> 

我沒有得到任何錯誤和鏈接的作品

我缺少什麼?我試着在網上尋找,但我遵循如果語法

回答

2

我認爲你只需要拆分你的語句,因爲<%= ...%>期望一個返回值,你試圖提供兩個,只是做類似:

<% if participant != current_user %> 
    <%= participant.username %>, <%= participant %> 
<% end %> 

當然,參與者和用戶名必須返回一些有意義的值。希望能幫助到你。

+0

太棒了!謝謝 – franklinexpress

相關問題