Displaying 1 result from an estimated 1 matches for "album_controller".
2006 Feb 19
2
Sortable list (scriptalicious) and updating database
I have made a sortable list which is sortable by dragging & dropping the
list elements. It works, but the order of the elements will not be
updated in the database. Hopefully someone could help me, or tell me
what I''m doing wrong.
Thnx!
Rgds,
Eric
Controller: album_controller.rb
class AlbumController < ApplicationController
def show_sort_album
@photos = Photo.find(:all)
end
def sort
@photos.each do |photo|
photo.position = params[''photo-list''].index(photo.id.to_s) + 1
photo.save
end
render :nothing => tru...