mirror of
https://github.com/iritmaximus/brewery.git
synced 2026-10-12 19:13:49 +03:00
13 lines
311 B
Ruby
13 lines
311 B
Ruby
class ApplicationController < ActionController::Base
|
|
helper_method :current_user
|
|
def current_user
|
|
return nil if session[:user_id].nil?
|
|
|
|
User.find_by_id session[:user_id]
|
|
end
|
|
|
|
def ensure_that_signed_in
|
|
redirect_to signin_path, notice: 'you should be signed in' if current_user.nil?
|
|
end
|
|
end
|