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)
<h2>Agenda Items</h2>
<% for agenda_item in @meeting.agenda_items %>
<p> <%= agenda_item.name %></p>
<% 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:
<h2>Agenda Items</h2>
<% for agenda_item in @meeting.agenda_items %>
<p> <%= in_place_editor_field :agenda_item, :name %></p>
<% 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:
<h2>Agenda Items</h2>
<% for agenda_item in @meeting.agenda_items %>
<p> <%= in_place_editor_field :meeting, :agenda_item %></p>
<% end %>
gives me "undefined method `agenda_item'' for
#<Meeting:0x4ae1678>"
===
This one:
<h2>Agenda Items</h2>
<% for agenda_item in @meeting.agenda_items %>
<p> <%= in_place_editor_field :meeting, :agenda_items %></p>
<% 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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---