ok, so fixed it myself.
working code:

--------------------------------------------------
template
--------------------------------------------------
<% @categories.each do |category| %>
  <%= sortable_element 'notes-list_' + category.id.to_s ,
  :constraint => false,
  :url => {:action => "sort_notes", :id => category.id},
  :complete => visual_effect(:highlight, 'notes-list_' +
category.id.to_s),
  :containment => containment
  %>
<% end %>

--------------------------------------------------
controller
--------------------------------------------------
def sort_notes
    sortables = nil
    @category_list = Category.find_all_by_user_id(current_user.id)
    @category_list.each do |category|
      if params['notes-list_' + category.id.to_s] then
        sortables = params['notes-list_' + category.id.to_s]
      end
    end
    sortables.each do |id|
      currentitem = Note.find_by_id(id.to_i)
      currentitem.position = sortables.index(id) + 1
      currentitem.category_id = params[:id]
      currentitem.save
    end
    render :nothing => true
  end

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-spinoffs@googlegroups.com
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