Skip to content

Instantly share code, notes, and snippets.

@patrickberkeley
Created January 4, 2009 02:07
Show Gist options
  • Save patrickberkeley/42981 to your computer and use it in GitHub Desktop.
Save patrickberkeley/42981 to your computer and use it in GitHub Desktop.
def change_main_image
project = Project.find(params[:id])
image = Image.find(params[:image_id])
render :partial => 'main_image', :locals => {:project => project, :image => image}
end
def sort_images
@project = Project.find(params[:id])
@project.images.each do |image|
# we must add one to compensate for the zero based index.
image.position = params["project_#{@project.id}_thumbnails"].index(image.id.to_s) + 1
image.save
end
render :nothing => true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment