in_place_editing
in_place_editing copied to clipboard
Cannot use in index scaffold view
This works when I use it in a scaffold edit view but it doesn't work when I use it in the index scaffold view? What is this?
I get an error similar to this:
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
My view code for index is standard like this:
<% @dogs.each do |dog| %>
The problem is in this code:
def in_place_editor_field(object, method, tag_options = {}, in_place_editor_options = {}) instance_tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)
How can I adapt this to work in my index view?
I just saw your comment, so it might be a bit late for you if you haven't figured it out by now...
<% @dogs.each do |dog| %> should actually be <% for @dog in @dogs%>
In Place Editing requires instance variables to work... like you rightly point out in the code. Local variables just don't cut it...