Sha256: 2f8c345fb0268fc9998112a3e0f0c0f9591d0c113a02b6e5276efaa4be8e12c3
Contents?: true
Size: 495 Bytes
Versions: 3
Compression:
Stored size: 495 Bytes
Contents
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) break unless user_id guard.nil? ? true : guard.call(Foyer.user_finder.call(user_id)) end constraints(constraint) do yield end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
foyer-0.5.0 | lib/foyer/rails.rb |
foyer-0.4.0 | lib/foyer/rails.rb |
foyer-0.3.1 | lib/foyer/rails.rb |