I have a PagesController which renders a partial collection of
Sections, each of which renders a partial collection of Lists, each
of which renders a partial collection of Items. All on the same
page, and it all works fine.
I’m attempting to turn the display of Item.name and Item.description
into edit-in-place fields, with no joy so far.
First question, I have this at the top of my controller:
class PagesController < ApplicationController
in_place_edit_for :item, :name
in_place_edit_for :item, :description
If I understand the framework code correctly, those two lines should
result in two new methods being declared, called set_item_name and
set_item_description. But when I insert a breakpoint() call just
after those lines, and look at the output of “methods”, they are not
listed. respond_to?(“set_item_name”) returns false as well. What am
I not understanding here?
When I include the following in my _item.rhtml:
<%= in_place_editor_field ‘item’, ‘name’ %>
I get this error in my browser:
Called id for nil, which would mistakenly be 4 – if you really
wanted the id of nil, use object_id
which happens in:
I’ve tried all combinations of :item, ‘item’, ‘name’ and :name in my
view to no avail (as I expected).
<%= item.name %> in the same partial works fine, so Rails can access
the “item” object and find out its name when it wants to.
I’ve tried this with 0.14.3 and edge rails, with the same result each
time. Am I doing something wrong, or is this broken in the latest