Sha256: 902e27504d50dfcaa4d04e9f51925db854f5c33960e2d37e200653aadb8692a5

Contents?: true

Size: 424 Bytes

Versions: 2

Compression:

Stored size: 424 Bytes

Contents

class Admin::BaseController < ActionController::Base
  include Pagy::Backend

  around_action :set_time_zone
  before_action :authenticate

  private
    def set_time_zone
      Time.use_zone(cookies[:time_zone]) { yield }
    end

    def authenticate
      if user = Admin::User.find_by_id(session[:admin_user_id])
        Admin::Current.user = user
      else
        redirect_to admin_sign_in_path
      end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
administration-zero-1.0.4 lib/generators/admin/install/templates/controllers/admin/base_controller.rb
administration-zero-1.0.3 lib/generators/admin/install/templates/controllers/admin/base_controller.rb