lib/foyer/rails.rb in foyer-0.2.2 vs lib/foyer/rails.rb in foyer-0.3.1
- old
+ new
@@ -4,10 +4,11 @@
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
+ break unless user_id
+ guard.nil? ? true : guard.call(Foyer.user_finder.call(user_id))
end
constraints(constraint) do
yield
end