为什么我感觉有人在我下面mousepoint_jumps
?那是错误:
SyntaxError in Posts#new
当我加载页面时:
C:/Sites/blog/app/views/posts/_form.html.erb:2: syntax error, unexpected ')', expecting keyword_then or ';' or '\n'
...ppend= ( if @post.errors.any? );@output_buffer.safe_concat('
... ^
C:/Sites/blog/app/views/posts/_form.html.erb:12: syntax error, unexpected keyword_end, expecting ')'
'); end
^
C:/Sites/blog/app/views/posts/_form.html.erb:26: syntax error, unexpected keyword_end, expecting ')'
'); end ;@output_buffer.to_s
^
C:/Sites/blog/app/views/posts/_form.html.erb:27: syntax error, unexpected keyword_ensure, expecting ')'
C:/Sites/blog/app/views/posts/_form.html.erb:29: syntax error, unexpected keyword_end, expecting ')'
提取的源代码(在第 2 行附近):
1: <%= form_for @post do |f| %>
2: <%= if @post.errors.any? %>
3: <div id="errorExplanation">
4: <h2><%= pluralize(@post.errors.count, "error") %> prohibited
5: this post from beign saved:</h2>
这是文件:
<%= form_for @post do |f| %>
<%= if @post.errors.any? %>
<div id="errorExplanation">
<h2><%= pluralize(@post.errors.count, "error") %> prohibited
this post from beign saved:</h2>
<ul>
<%= @post.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.label :title %><br>
<%= f.text_field :title %>
</p>
<p>
<%= f.label :text %><br>
<%= f.text_area :text %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
我在那个 ruby 教程中努力而深入地工作,但一些好的错误背后是一些东西。我喜欢错误,是真的。但这太过分了!我可以在这里找到我做错工作的任何证据吗?