Forum: Ruby on Rails in_place_editor_field inside a partial collection

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Joon L. (Guest)
on 2005-11-14 04:29
(Received via mailing list)
(I've already posted this to a quite unrelated thread. Sorry for those
reading this twice.)

Did anybody succeeded in using "in_place_editor_field" inside a
partial collection?
It's working perfectly in a regular template, but the id part becomes
blank when it's inside a partial collection.

class ArticleController < ApplicationController
  in_place_edit_for :comment, :body

<li id="comment-<%= %>">
<%= in_place_editor_field :comment, :body %>

<ol id="comments">
<% unless @article.comments == nil %>
<%= render :partial => "comment", :collection => @article.comments %>
<% end %>

Generated HTML:
<li id="comment-21">
<span class="in_place_editor_field" id="comment_body__in_place_editor"
tag="span"></span><script type="text/javascript">
new Ajax.InPlaceEditor('comment_body__in_place_editor',

[comment_body__in_place_editor] should be
Apparently, the id is not set properly.

More odd thing is that when a comment is added using AJAX, above code
is working again.

I also tried to include :id as follows:
<%= in_place_editor_field :comment, :body, { :id => } %>

But in this case, [comment_body__in_place_editor] only becomes [21],
but not [comment_body_21_in_place_editor]

Here are the docs for InPlaceEditing:

What am I missing here?

This topic is locked and can not be replied to.