So, I have this code in a partial called "_form.html.erb" in "app/views/posts":
<%= form_for @post do |f| %>
<% if @post.errors.any? %>
<h2>Errores:</h2>
<ul>
<% @post.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
<% end %>
<p>
<%= f.label :title %><br />
<%= f.text_field :title %><br />
<br />
<%= f.label :content %><br />
<%= f.text_area :content %>
</p>
And I have two views with this code:
"app/views/posts/new.html.erb"
<h1>Nuevo post</h1>
<%= render 'form' %>
<p>
<%= f.submit "Agregar Nuevo Post" %>
</p>
<% end %>
"app/views/posts/edit.html.erb"
<h1>Editar Post</h1>
<%= render 'form' %>
<p>
<%= f.submit "Actualizar Post" %>
</p>
<% end %>
What I want is the form to render in the views, but with the code I have shown to you I'm getting this error output in the server:
SyntaxError in Posts#new
Showing /home/levick/rubyblog/app/views/posts/new.html.erb where line #10 raised:
/home/levick/rubyblog/app/views/posts/new.html.erb:10: syntax error, unexpected keyword_ensure, expecting $end
Extracted source (around line #10):
7: </p>
8: <% end %>
Trace of template inclusion: app/views/posts/new.html.erb
Rails.root: /home/levick/rubyblog
Application Trace | Framework Trace | Full Trace
Request
Parameters:
None
Show session dump
Show env dump
Response
Headers:
None
The same with the edit view.
My Question is: What did I do wrong?
Thanks!