def map_reflection_for( path )
      raise "reflection for #{path.inspect} already exists" unless reflections[path].nil?

      reflection = path.empty? ? top_level_model : begin
        parent = reflection_for( path[0..-2] )
        if !Authorization.is_a_association_proxy?(parent) and parent.respond_to?(:klass)
          parent.klass.reflect_on_association( path.last )
        else
          parent.reflect_on_association( path.last )
        end
      rescue
        parent.reflect_on_association( path.last )
      end
      raise "invalid path #{path.inspect}" if reflection.nil?

      reflections[path] = reflection
      map_table_alias_for( path )  # Claim a table alias for the path.

      # Claim alias for join table
      # TODO change how this is checked
      if !Authorization.is_a_association_proxy?(reflection) and !reflection.respond_to?(:proxy_scope) and reflection.is_a?(ActiveRecord::Reflection::ThroughReflection)
        join_table_path = path[0..-2] + [reflection.options[:through]]
        reflection_for(join_table_path, true)
      end
      
      reflection
    end
def map_reflection_for( path )
      raise "reflection for #{path.inspect} already exists" unless reflections[path].nil?

      reflection = path.empty? ? top_level_model : begin
        parent = reflection_for( path[0..-2] )
        if !Authorization.is_a_association_proxy?(parent) and parent.respond_to?(:klass)
          parent.klass.reflect_on_association( path.last )
        else
          parent.reflect_on_association( path.last )
        end
      rescue
        parent.reflect_on_association( path.last )
      end
      raise "invalid path #{path.inspect}" if reflection.nil?

      reflections[path] = reflection
      map_table_alias_for( path )  # Claim a table alias for the path.

      # Claim alias for join table
      # TODO change how this is checked
      if !Authorization.is_a_association_proxy?(reflection) and !reflection.respond_to?(:proxy_scope) and reflection.is_a?(ActiveRecord::Reflection::ThroughReflection)
        join_table_path = path[0..-2] + [reflection.options[:through]]
        reflection_for(join_table_path, true)
      end
      
      reflection
    end
Attempts to map a reflection for the given path.  Raises if already defined.