2011-04-07 79 views
2

當我加載我的視頻節目視圖時出現此錯誤:如何修復此語法錯誤?

SyntaxError in Videos#show 

Showing /rubyprograms/dreamstill/app/views/comments/new.html.erb where line #1 raised: 

compile error 
/rubyprograms/dreamstill/app/views/comments/new.html.erb:1: syntax error, unexpected tASSOC, expecting kEND 
...deo.comments.new]), :remote => true do |f| @output_buffer.sa... 
         ^
/rubyprograms/dreamstill/app/views/comments/new.html.erb:6: syntax error, unexpected kENSURE, expecting $end 

它在我的評論/ new.html.erb文件中指向此表單:

<%= simple_form_for([@video, @video.comments.new]), :remote => true do |f| %> 
    <%= f.association :comment_title, :collection => @video.comment_titles, :label => "Comment Title:", :include_blank => false %> 
    <%= f.input :body, :label => false, :placeholder => "Post a comment." %> 
    <%= f.button :submit, :value => "Post" %> 
<% end %> 

這已加載到我的視頻節目中用這一行查看:

<%= render :file => 'comments/new' %> 

如何修復此錯誤?

回答

8

你想:

<%= simple_form_for([@video, @video.comments.new], :remote => true) do |f| %> 

基本上:remote => true應該是simple_form_for的參數。

5

嘗試:

<%= simple_form_for [@video, @video.comments.new], :remote => true do |f| %> 
相關問題