Thanks for the reply. It actually works now but using bugzilla I see
that internally theres the error

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.index

I just don't understand why. It does now update the pos in the
database, and the list is correct... I guess
I shouldn't complain anymore, but I would still like to understand
this behavior.

Thanks again for your response

On Jul 30, 4:10 pm, Robby Russell <[EMAIL PROTECTED]> wrote:
> Renzo wrote:
> > Hi, i'm having trouble implementing a sortable drag and drop list. in
> > my controller i have the following code:
> >     def sort
> >       @test_case = TestCase.find(params[:id])
> >       @test_case.tasks.each do |task|
> >         task.position = params['task-list'].index(task.id.to_s) + 1
> >         task.save
> >       end
> >       render :layout => false
> >     end
>
> > the drag and drop operations work but the database does not get
> > updated. The list to be updated is in another controller though. I
> > have tried several ways but still haven't got the DB to update. The
> > code where i call the function:
>
> > <%= sortable_element 'task_list', :url => { :action => "sort", :id =>
> > test_case.id, :controller => 'test_case' },
> >    :complete => visual_effect(:highlight, 'task_list')%>
>
> Have you tail'd your log files yet?
>
> --
> Robby Russellhttp://www.robbyonrails.com     # my 
> bloghttp://www.planetargon.com      # my 
> businesshttp://www.programmingrails.com # my book


--~--~---------~--~----~------------~-------~--~----~
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