我该如何修复这个语法错误?

发布于 2024-10-31 04:58:21 字数 1074 浏览 1 评论 0原文

当我加载视频显示视图时,我收到此错误:

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' %>

如何修复此错误?

I get this error when I load my video show view:

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

It points to this form in my comments/new.html.erb file:

<%= 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 %>

which is loaded into my video show view with this line:

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

How can I fix this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅黛梨妆こ 2024-11-07 04:58:21

你想要:

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

基本上 :remote => true 应该是 simple_form_for 的一个参数。

You want:

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

Basically the :remote => true was supposed to be a parameter of simple_form_for.

安静被遗忘 2024-11-07 04:58:21

尝试:

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

Try:

<%= simple_form_for [@video, @video.comments.new], :remote => true do |f| %>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文