class Clearance::Constraints::SignedOut
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.
Public Instance Methods
matches?(request)
click to toggle source
# File lib/clearance/constraints/signed_out.rb, line 14 def matches?(request) @request = request missing_session? || clearance_session.signed_out? end
Private Instance Methods
clearance_session()
click to toggle source
@api private
# File lib/clearance/constraints/signed_out.rb, line 22 def clearance_session @request.env[:clearance] end
missing_session?()
click to toggle source
@api private
# File lib/clearance/constraints/signed_out.rb, line 27 def missing_session? clearance_session.nil? end