Sha256: 67663015dcfbd65347aa4f5e59c2bc227fd5ec7fbcbf5e06eca0e600c66f4af0

Contents?: true

Size: 596 Bytes

Versions: 3

Compression:

Stored size: 596 Bytes

Contents

module Simplec
  class Subdomains
		def self.matches?(request)
      present = request.subdomain.present?
		  not_admin = request.subdomain != 'admin'
	    subdomain = Simplec::Subdomain.find_by(name: request.subdomain)

			match = present && not_admin && subdomain

      if match
        Thread.current[:simplec_subdomain] = subdomain
      else
        Rails.logger.info <<-LOG unless match
Simplec Subdomain '#{request.subdomain}' was not found.
  ActionDispatch::Request#original_url: #{request.original_url}
  'admin' subdomain bypass: #{!not_admin}
LOG
      end

			match
		end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simplec-0.2.0 app/constraints/simplec/subdomains.rb
simplec-0.1.2 app/constraints/simplec/subdomains.rb
simplec-0.1.0 app/constraints/simplec/subdomains.rb