Sha256: cd9ec6acdcc2a2ab0e9912e2e1b654e16de88f88e4b5bea043284ad8aa44a817

Contents?: true

Size: 739 Bytes

Versions: 9

Compression:

Stored size: 739 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'

    helper NdrUi::BootstrapHelper

    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

9 entries across 9 versions & 1 rubygems

Version Path
ndr_error-2.4.1 app/controllers/ndr_error/application_controller.rb
ndr_error-2.4.0 app/controllers/ndr_error/application_controller.rb
ndr_error-2.3.2 app/controllers/ndr_error/application_controller.rb
ndr_error-2.3.1 app/controllers/ndr_error/application_controller.rb
ndr_error-2.3.0 app/controllers/ndr_error/application_controller.rb
ndr_error-2.2.0 app/controllers/ndr_error/application_controller.rb
ndr_error-2.1.0 app/controllers/ndr_error/application_controller.rb
ndr_error-2.0.3 app/controllers/ndr_error/application_controller.rb
ndr_error-2.0.0 app/controllers/ndr_error/application_controller.rb