Sortable lists within categories?

Hello, I would like to have many sortable lists each within it's own category item. I would like the categories to be sortable as well as to be able to sort items from within each category into different categories.

Is this even possible before I stress myself out big time about it?

I'm not the best programmer in the world. Often I will get started on something like this and it never gets finished because it's just impossible -- thus further killing my programming ego!

I know that I can sort between lists by using the containment operator, but I have not seen any code as to what the actions should look like. Furthermore, by having categories also sortable will this cause any additional problems?

I found this it is exactly what I need, although I still don't know what to do in the actions for multiple sortable lists like this.

I've done single-list sorting before and my action looks like this.

  def order_elements     params[:elements].each_with_index do |id, position|       Section.update(id, :position => position+1)     end   end