I am using Rais3 and in_place_editing plugin.
Here is controller’s code:
in_place_edit_for :name, :title
And here is index.html.erb:
<% @contracts.each do |contract| %>
<tr>
<td><%= contract.name %></td>
<td><%= contract.title %></td>
<td><%= contract.content %></td>
<td><%= link_to 'Show', contract %></td>
<td><%= link_to 'Edit', edit_contract_path(contract) %></td>
<td><%= link_to 'Destroy', contract, :confirm => 'Are you sure?', :method => :delete %></td>
<td><%= in_place_editor_field contract, 'name' %></td>
</tr>
<% end %>
I have just added one line to the view:
<td><%= in_place_editor_field contract, 'name' %></td>
I have got nex error code:
Called id for nil, which would mistakenly be 4 — if you really wanted
the id of nil, use object_id
Here is a fill stack.
How can I fix this error?
Actually, the controller should probably say
assuming you have a contract model and want to inline edit title. Then also the view needs to be changed to reflect title and not name for the inline edit. Which field do you want to edit inline (both?)?
Along the lines of the plugin example:
EDIT
Change the view to have an instance variable