## [plaintext]

Using Ajax.InPlaceCollectionEditor and in_place_collection_editor_field. This worked for me:


## application_helper.rb [ruby]

def in_place_collection_editor_field(object,method,container, tag_options={})
tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)
tag_options = { :tag => "span",
:id => "#{object}_#{method}_#{tag.object.id}_in_place_editor",
:class => "in_place_editor_field" }.merge!(tag_options)
url = url_for( :action => "set_#{object}_#{method}", :id => tag.object.id )
collection = container.inject([]) do |options, element|
options << "[ '#{escape_javascript(element.last.to_s)}', '#{escape_javascript(element.first.to_s)}']"
end
function = "new Ajax.InPlaceCollectionEditor("
function << "'#{object}_#{method}_#{tag.object.id}_in_place_editor',"
function << "'#{url}',"
function << "{collection: [#{collection.join(',')}], id: '#{object}_#{method}'});"
tag.to_content_tag(tag_options.delete(:tag), tag_options) + javascript_tag(function)
end

## products_controller.rb [ruby]

in_place_edit_for :product, :alt_event_name



## edit.rhtml [rhtml]

<%= in_place_collection_editor_field :product, :alt_event_name, event_options -%>