In_place_editor_field inside a partial collection


(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



  • <%= in_place_editor_field :comment, :body %>
  • show.rhtml:

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

    Generated HTML:

  • ....

    [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?