(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.
article_controller.rb:
class ArticleController < ApplicationController
in_place_edit_for :comment, :body
…
end
_comment.rhtml:
show.rhtml:
…
-
<% unless @article.comments == nil %>
<%= render :partial => "comment", :collection => @article.comments %>
<% end %>
Generated HTML:
…
[comment_body__in_place_editor] should be
[comment_body_21_in_place_editor].
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 => comment.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:
http://rails.rubyonrails.com/classes/ActionController/Macros/InPlaceEditing/ClassMethods.html
http://rails.rubyonrails.com/classes/ActionView/Helpers/JavaScriptMacrosHelper.html#M000367
What am I missing here?
–Joon