我的 html.erb 文件有什么问题?
What i wrong with my html.erb file?
从下面的代码中,我得到以下错误:
/home/ubuntu/workspace/portfolio/app/views/projects/_project_form.html.erb:36: 语法错误,意外 keyword_ensure,预期输入结束
因为这是一个语法错误,我想我不需要提供其他细节,但如果你们需要我post,请随时询问。
<%= form_for @project do |f| %>
<% if @project.errors.any? %>
<div id="error_explanation">
<h2>
<%= "#{pluralize(@project.errors.count, "error")} prohibited this project from being saved:" %>
</h2>
<ul>
<% @project.errors.full_messages.each do |msg| %>
<li>
<%= msg %>
</li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :client %>
<p>
<%= @project.client.name %>
</p>
<%= f.hidden_field:note_id, value: @project.client.id %>
<% end %>
</div>
<div class="field">
<%= f.label :project_description %>
<%= f.text_area :project_description %>
</div>
<div class="field">
<%= f.label :project_timescale %>
<%= f.text_field :project_timescale %>
</div>
<div class="actions">
<%= f.submit 'Save' %>
</div>
<% end %>
编辑表格:--
<%= form_for @project do |f| %>
<% if @project.errors.any? %>
<div id="error_explanation">
<h2>
<%= "#{pluralize(@project.errors.count, "error")} prohibited this project from being saved:" %>
</h2>
<ul>
<% @project.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.hidden_field :note_id, value: @project.client.id %>
<div class="field">
<%= f.label :client %>
<p>
<%= @project.client.name %>
</p>
</div>
<div class="field">
<%= f.label :project_description %>
<%= f.text_area :project_description %>
</div>
<div class="field">
<%= f.label :project_timescale %>
<%= f.text_field :project_timescale %>
</div>
<div class="actions">
<%= f.submit 'Save' %>
</div>
<% end %>
错误是由于 hidden field
下面的额外 <% end %>
从下面的代码中,我得到以下错误:
/home/ubuntu/workspace/portfolio/app/views/projects/_project_form.html.erb:36: 语法错误,意外 keyword_ensure,预期输入结束
因为这是一个语法错误,我想我不需要提供其他细节,但如果你们需要我post,请随时询问。
<%= form_for @project do |f| %>
<% if @project.errors.any? %>
<div id="error_explanation">
<h2>
<%= "#{pluralize(@project.errors.count, "error")} prohibited this project from being saved:" %>
</h2>
<ul>
<% @project.errors.full_messages.each do |msg| %>
<li>
<%= msg %>
</li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :client %>
<p>
<%= @project.client.name %>
</p>
<%= f.hidden_field:note_id, value: @project.client.id %>
<% end %>
</div>
<div class="field">
<%= f.label :project_description %>
<%= f.text_area :project_description %>
</div>
<div class="field">
<%= f.label :project_timescale %>
<%= f.text_field :project_timescale %>
</div>
<div class="actions">
<%= f.submit 'Save' %>
</div>
<% end %>
编辑表格:--
<%= form_for @project do |f| %>
<% if @project.errors.any? %>
<div id="error_explanation">
<h2>
<%= "#{pluralize(@project.errors.count, "error")} prohibited this project from being saved:" %>
</h2>
<ul>
<% @project.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.hidden_field :note_id, value: @project.client.id %>
<div class="field">
<%= f.label :client %>
<p>
<%= @project.client.name %>
</p>
</div>
<div class="field">
<%= f.label :project_description %>
<%= f.text_area :project_description %>
</div>
<div class="field">
<%= f.label :project_timescale %>
<%= f.text_field :project_timescale %>
</div>
<div class="actions">
<%= f.submit 'Save' %>
</div>
<% end %>
错误是由于 hidden field
<% end %>