Thanks Christophe :)

My bad on the duplicate ID's. I only just added them at the end trying
to figure out why the ajax submit didn't work :) Though I don't
actually need it in this case :)

As far as the B suggestion goes, I'm having trouble understanding you.

On the rails side, this is how I'm updating the order of things (since
the absense of a checkbox also translates to the absense of a row on
the join table):

      @component_instance.component_instance_nuggets.clear
        if params[nugget_group]
          params[nugget_group].each_with_index do |ci, position|
 
@component_instance.component_instance_nuggets.create({:nugget_code =>
nugget_group, :nugget_id => ci[0], :position => position})
          end
        end

The numbers in the mookie[4] type names are the id of the other end of
the join in the has_many :through table. Thus using the submit order
of the input elements was working quite well to set the order (or
removal) of the elements in the database.

I guess one other option is to encode the order of each element in the
value attribute. So that when a sortable is reordered, some javascript
runs and adds an elements position in the list to its value field.
Then when the form is submitted I could read the value of each.

Does this sound like a good solution?

Cheers,

Brendon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to