Sha256: 4ea49293af3874c05368702258b91f3f0ec4265179456f2b365048eb6761e79d

Contents?: true

Size: 474 Bytes

Versions: 12

Compression:

Stored size: 474 Bytes

Contents

module Lines
  class ApplicationController < ActionController::Base

    private

      # sets the current_user if one exists in session
      def current_user
        @current_user ||= User.find(session[:user_id]) if session[:user_id]
      end
      helper_method :current_user

      # checks if current user is authorized. Redirects to login_url if not
      def authorize
        redirect_to login_url, alert: "Not authorized" if current_user.nil?
      end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lines-engine-0.1.14 app/controllers/lines/application_controller.rb
lines-engine-0.1.13 app/controllers/lines/application_controller.rb
lines-engine-0.1.12 app/controllers/lines/application_controller.rb
lines-engine-0.1.11 app/controllers/lines/application_controller.rb
lines-engine-0.1.10 app/controllers/lines/application_controller.rb
lines-engine-0.1.9 app/controllers/lines/application_controller.rb
lines-engine-0.1.8 app/controllers/lines/application_controller.rb
lines-engine-0.1.7 app/controllers/lines/application_controller.rb
lines-engine-0.1.6 app/controllers/lines/application_controller.rb
lines-engine-0.1.5 app/controllers/lines/application_controller.rb
lines-engine-0.1.4 app/controllers/lines/application_controller.rb
lines-engine-0.1.3 app/controllers/lines/application_controller.rb