Sha256: 8d3217de6a0ce94ffe294f28345a61047bcba5e30d85038f91378494ff6389c7

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require 'ndr_ui'

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

2 entries across 2 versions & 1 rubygems

Version Path
ndr_error-2.0.2 app/controllers/ndr_error/application_controller.rb
ndr_error-2.0.1 app/controllers/ndr_error/application_controller.rb