Sha256: ccd0c0926a007da7873a88e1ed8c7b73e740858d8a9c0ea630ba0a38f0bd3145

Contents?: true

Size: 704 Bytes

Versions: 4

Compression:

Stored size: 704 Bytes

Contents

module NdrError
  # Global controller logic
  class ApplicationController < ActionController::Base
    before_action :authenticate

    # Ensure Rails doesn't find any host layouts first:
    layout 'ndr_error/ndr_error'

    private

    def authenticate
      return if NdrError.check_current_user_authentication.call(self)

      flash[:error] = 'You are not authenticated.'
      redirect_to main_app.url_for('/')
    end

    # Split out delimited search terms of more than 3 characters in length.
    def extract_keywords(query, split_on_space = true)
      splitter = split_on_space ? %r{[,;\\/\s]+} : %r{[,;\\/]+}
      (query || '').split(splitter).reject { |k| k.length < 3 }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ndr_error-1.1.4 app/controllers/ndr_error/application_controller.rb
ndr_error-1.1.3 app/controllers/ndr_error/application_controller.rb
ndr_error-1.1.2 app/controllers/ndr_error/application_controller.rb
ndr_error-1.1.1 app/controllers/ndr_error/application_controller.rb