加载视频节目视图时出现此错误:
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
它在我的comments / 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' %>
如何解决此错误?
答案 0 :(得分:8)
你想:
<%= simple_form_for([@video, @video.comments.new], :remote => true) do |f| %>
基本上:remote => true
应该是simple_form_for的参数。
答案 1 :(得分:5)
尝试:
<%= simple_form_for [@video, @video.comments.new], :remote => true do |f| %>