Hey all, I have a sortable element list that looks like this:
<ul id="yourranking" style=" list-style-type:none; margin:0; padding:0;"> <% @uranks.each do |u| %> <li id="item_<%= u.id %>"> <%= u.rank %> <%= u.item.title %> </li> <% end %> </ul> <p id="list-info"></p>
<%= sortable_element 'yourranking', :update => 'list-info', :complete => visual_effect(:highlight, 'yourranking'), :url => { :controller=>"lists",:action => "order", :listid=> 'yourranking'} %> </fieldset>
this is the controller code: def order params[params[:listid]].each_with_index { |id,idx| Urank.update(id, :rank => idx) } end
I would like to keep track of the old ranking before the latest update like:
Urank.update(id,:rank=>idx,:oldrank=><old rank before update>)
any idea how to do that?
thanx in advance
Pat