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: redirect_controller.rb
    path of file: ./repos/identity-idp/app/controllers/redirect
    
    the code of the file until where you have to start completion: module Redirect
  class RedirectController < ApplicationController
    PERMITTED_LOCATION_PARAMS = [:flow, :step, :location].freeze

    private

    def location_params
      params.permit(*PERMITTED_LOCATI
    
    def redirect_to_and_log(url, event: nil, tracker_method: analytics.method(:external_redirect))
      if event
        # Once all events have been moved to tracker methods, we can remove the event: param
        analytics.track_event(event, redirect_url: url, **location_params)
      else
        tracker_method.call(redirect_url: url, **location_params)
      end