<commit_before>require 'action_dispatch/routing/mapper'

module ActionDispatch
  module Routing
    class Mapper
      def authenticate(guard = nil)
        constraint = lambda do |request|
          user_id = request.env['rack.session'][Foyer.session_key].try(:[], :id)
          guard.nil? ? true : guard.call(Foyer.user_finder.call(user_id)) if user_id
        end

        constraints(constraint) do
          yield
        end
      end
    end
  end
end<commit_msg>Ensure session keys can be accessed with symbols<commit_after>require 'action_dispatch/routing/mapper'

module ActionDispatch
  module Routing
    class Mapper
      def authenticate(guard = nil)
        constraint = lambda do |request|
          user_id = request.env['rack.session'][Foyer.session_key].try(:with_indifferent_access).try(:[], :id)
          guard.nil? ? true : guard.call(Foyer.user_finder.call(user_id)) if user_id
        end

        constraints(constraint) do
          yield
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0913604766633565, 'fraction_numerical': 0.0, 'mean_word_length': 2.6389891696750905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2084575', 'n_tokens_mistral': 302, 'n_tokens_neox': 300, 'n_words': 70}