luis@328: class AuthorshipsController < ApplicationController luis@328: luis@1364: def sort luis@1364: @authorships = Authorship.find(params['authorship']) luis@1364: luis@1364: @authorships.each do |authorship| luis@1364: luis@1364: # note: auth_order is usually called position (default column name in the acts_as_list plugin ) luis@1364: authorship.auth_order = params['authorship'].index(authorship.id.to_s) + 1 luis@1364: authorship.save luis@1364: end luis@1364: luis@1364: render :nothing => true, :status => 200 luis@1364: end luis@328: end