Hi Scott,
I'm going to haml here because rhtml sucks hard to code:
edit_multiple.haml:
= form_tag :controller => 'guests', :action => 'update_multiple'
%table
= render :partial => 'form', :collection => @guests
_form.haml:
%tr
%td= input_tag "guest[#{guest.id}][name]", guest.name
%td= input_tag "guest[#{guest.id}][company]", guest.company
...
guests_controller.rb:
class GuestsController < ApplicationController
# RESTful routes or:
verify :method => :post, :params => :guest, :only => :update_multiple
def update_multiple
guest_ids = params[:guest].keys
# better off by placing this in the model...
Guest.transaction do
guest_ids.each { |guest_id| Guest.update guest_id, params[guest_id] }
end
end
end
Untested!
Regards
Florian