I am learning Rails 5.0 from a tutorial, and in this tutorial it uses f.objectone that I am not familiar with. f.objectpassed to ERb in error handling method.
I know what fis the object / instance of the post submitted to the form. But I do not understand what it is f.object.
edit.html.erb (file with form):
<%= form_for(@section) do |f| %>
<%= error_messages_for(f.object) %>
<table summary="Subject form fields">
<tr>
<th>Name</th>
<td><%= f.text_field(:name) %></td>
</tr>
<tr>
<th>Position</th>
<td><%= f.select(:position, 1..@subject_count) %></td>
</tr>
</table>
<% end %>
There is no HTML form element known as object, and this is what usually happens after f., so it really looked like what it could be.
source
share