class Admin::ImagesController < Admin::ApplicationController def new case @request.method when :post params[:image].each_with_index do |image, name| end # render :text => params[:photo].inspect end end def sort Image.order(params[:image]) render :nothing => true end def update_positions params[:images].each_with_index do |id, position| Image.update(id, :position => position) end render :nothing => true end def update_description @image = Image.find(params[:id]) @image.update_attributes(params[:image]) render(:partial => "shared/image", :object => @image, :layout => false) end def add_image @image = Image.new(params[:image]) if @image.save if @image.item_id redirect_to :controller => 'items', :action => 'show', :id => @image.item_id else redirect_to :controller => 'auctions', :action => 'item', :id => @image.auction_item_id end end end def delete_image Image.find(params[:id]).destroy render :nothing => true end end