Ok, I’m clearly missing the boat on something here, I think about how
to reference a child record (collection instance?) when using
in_place_edit_field. Meeting and AgendaItem are both models,
AgendaItem.name is the :text field I want to work with.
I have some code in my .rhtml like this (meeting has_many agenda_items)
Agenda Items
<% for agenda_item in @meeting.agenda_items %><%= agenda_item.name %>
<% end %>The controller method for this view is as follows:
def show
@meeting = Meeting.find(params[:id])
@users = User.find_all
end
This works as-expected. Now I want to be able to in_place_edit the
agenda items. I’ve tried several permutations, but none of them work.
this, for example:
Agenda Items
<% for agenda_item in @meeting.agenda_items %><%= in_place_editor_field :agenda_item, :name %>
<% end %>Gives me “Called id for nil, which would mistakenly be 4 – if you
really wanted the id of nil, use object_id”
====
This one:
Agenda Items
<% for agenda_item in @meeting.agenda_items %><%= in_place_editor_field :meeting, :agenda_item %>
<% end %>gives me “undefined method `agenda_item’ for #Meeting:0x4ae1678”
====
This one:
Agenda Items
<% for agenda_item in @meeting.agenda_items %><%= in_place_editor_field :meeting, :agenda_items %>
<% end %>gives me the page, but the in_place_edit fiels shows “######” is
initial mode, and when clicked shows
“#agendaitem:0x4b8b3f8#agendaitem:0x4b8b3bc#agendaitem:0x4b8b380#agendaitem:0x4b8b344</agendaitem:0x4b8b344></agendaitem:0x4b8b380></agendaitem:0x4b8b3bc></agendaitem:0x4b8b3f8>”
which I assume is the OIDs of the agenda items in the collection.
So I think my question is, what object and method do I pass to
in_place_edit_field in this instance?