Class: Admin::ImageRotatorImagesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/image_rotator_images_controller.rb

Instance Method Summary collapse

Instance Method Details

#update_positionsObject



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/admin/image_rotator_images_controller.rb', line 10

def update_positions
  0.upto((newlist ||= params[:ul]).length - 1) do |index|
    hash = newlist[index.to_s]
    moved_item_id = hash['id'].split(/image_rotator_image_/)
    image = ImageRotatorImage.find_by_id(moved_item_id)
    image.insert_at(index + 1)
  end

  render :nothing => true
end