Sha256: 7a9ecde5aa56ae3a078a3280a29be6be2b1762dbada73bbca3051ebf1b08503a
Contents?: true
Size: 788 Bytes
Versions: 32
Compression:
Stored size: 788 Bytes
Contents
module Clearance module Constraints # Can be applied to make a set of routes visible only to users that are # signed out. # # # config/routes.rb # constraints Clearance::Constraints::SignedOut.new do # resources :registrations, only: [:new, :create] # end # # In the example above, requests to `/registrations/new` from users that are # signed in will result in a 404. class SignedOut def matches?(request) @request = request missing_session? || clearance_session.signed_out? end private # @api private def clearance_session @request.env[:clearance] end # @api private def missing_session? clearance_session.nil? end end end end
Version data entries
32 entries across 32 versions & 1 rubygems