You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pages_controller.rb
    path of file: ./repos/Spina/app/controllers/spina/admin
    
    the code of the file until where you have to start completion: module Spina
  module Admin
    class PagesController < AdminController
      before_action :set_locale
      before_action :set_page, only:
    
      def sort
        params[:ids].each.with_index do |id, index|
          Page.where(id: id).update_all(position: index + 1)
        end

        flash.now[:info] = t("spina.pages.sorting_saved")
        render_flash
      end