Sortable list doesn't work on production server

I have a sortable list in one of my views, using the sortable example
from the recipes book. The sorting works great on my mac. When I throw
it on the server for testing it doesn’t save the display order.

I cracked open the log file and see that it’s not even returning the
id’s like it should:

Parameters: {“action”=>“sort”,
“id”=>"#Navigation:0x2a96ba54b8/#Navigation:0x2a96ba5440/#Navigation:0x2a96ba53a0/#Navigation:0x2a96ba5170/#Navigation:0x2a96ba50f8/#Navigation:0x2a96ba5058/#Navigation:0x2a96ba4e28",
“controller”=>“admin/navigations”}

On my mac this is what i get in the logs:

Parameters: {“menu-list”=>[“15”, “13”, “14”, “12”], “action”=>“sort”,
“id”=>"#Navigation:0x2221a5c/#Navigation:0x2221a20/#Navigation:0x22219e4/#Navigation:0x2221994",
“controller”=>“admin/navigations”}

I’m using ruby 1.8.4 with rails 1.1.2 on both machines. The only
difference is from mac to RHEL4

Can anyone give me an idea of what could be the problem?

In case you need it, this is the action:

def sort
@navigation = Navigation.find(:all)
@navigation.each do |menu_item|
menu_item.display_order =
params[‘menu-list’].index(menu_item.id.to_s) + 1
menu_item.save
end
render :nothing => true
end

This my view:

    <% @navigation.each do |menu| %>
  • <%= link_to image_tag("/images/go.png", :border => '0'), :action => 'edit', :id => menu.id %><%= menu.name %>
    <%= link_to image_tag("/images/delete.png", :border => '0'), {:action => 'destroy', :id => menu.id}, :confirm => 'Are you sure you want to delete this menu item? You cannot undo this action!' %>
      <% end %>

      <%= sortable_element ‘menu-list’,
      :url => { :action => “sort”, :id => @navigation },
      :complete => visual_effect(:highlight, ‘menu-list’)
      %>

    This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

    | Privacy Policy | Terms of Service | Remote Ruby Jobs