I’m using Ajax to create a list of items. Once these items have been
created the user can edit in place and delete them. I’ve got the ajax
working for delete and removing the element from the page, but the
in_place_editor_field doesn’t seem to like being in a for loop. I’ve
got in_place_editor working for single items, but what’s the syntax
for creating editors for a list of items.
Here’s my code so far:
<% if @feeds -%>
<% for feed in @feeds %>
(:feed, :url) %> - <%= link_to_remote “Delete”, :update =>
“feed”, :url => { :action => “destroy_feed”, :id => feed.id } %>
<% end -%>
<% end -%>
The error I am getting back is:
Called id for nil, which would mistakenly be 4 – if you really
wanted the id of nil, use object_id
I’m assuming this is because the in_place_editor is being called with
an incorrect id, the backtrace points to this line of the javascript
macro helper file:
tag_options = {:tag => “span”, :id => “#{object}#{method}#
{tag.object.id}_in_place_editor”, :class =>
“in_place_editor_field”}.merge!(tag_options)
Any ideas on syntax to solve this?
David
David S.
w: http://davidsmalley.com/blog