Sortable_element trouble

I need some reordering functionality so I tried the sortable_element
helper. It is giving me trouble though. I have a show view that looks
like this (HAML):

%ul#items
= render :partial => @menu.items
= sortable_element :items, :url => { :action => ‘inspect_params’ },
:complete => “alert(request.responseText);”

I’m doing two things here: Rendering a partial with a lot of menu items
(that should be able to be reordered) and output a piece of Javascript
that creates a new Sortable. The output looks like this:

  • Home
  • About
  • Contact

The inspect_params action in the MenusController looks like this:

render :text => params.inspect

And that’s about it. This is every Javascript developer’s nightmare:
Nothing happens at all. And the nightmare has become true. No alert box,
not even a request. If you open Firebug and drag some list items around,
nothing happens in the console.

And do you know what the real funny thing is? If you make a link to the
same action on the same page, it works fine!

= link_to_remote “Link”, :url => {:action => ‘inspect_params’}

The request gets sent and returns something like:
{“authenticity_token”=>"…", “action”=>“inspect_params”, “controller”
=> “menus”} I’ve been wondering if it has anything to do with the way I
positioned the Javascript: in the bottom of . Is that good?

Can anyone help me out here? This problem has twisted my brain for two
days…

David T. wrote:

Can anyone help me out here? This problem has twisted my brain for two
days…

OK, after a bit of research I found a solution:

http://dev.rubyonrails.org/ticket/6489

Ghosting (for some reason) needs to be enabled to trigger a request…