Module: BlogBasic::ApplicationHelper

Defined in:
app/helpers/blog_basic/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_userObject



8
9
10
11
12
13
# File 'app/helpers/blog_basic/application_helper.rb', line 8

def current_user
  logger.info "Current user ID: " + session[:user_id].to_s 
  if signed_in?
    session[:user_id]
  end
end

#ensure_signed_inObject



15
16
17
18
19
20
# File 'app/helpers/blog_basic/application_helper.rb', line 15

def ensure_signed_in
  unless signed_in?
    session[:redirect_to] = request.request_uri
    redirect_to(new_session_path)
  end
end

#signed_in?Boolean

Returns:

  • (Boolean)


3
4
5
6
# File 'app/helpers/blog_basic/application_helper.rb', line 3

def signed_in?
  logger.debug "(helper) Logged in: " + session[:user_id].to_s + " == " +  BlogBasic::BlogConf.data['identity'].to_s
  session[:user_id] == BlogBasic::BlogConf.data['identity']
end