Class: BlogBasic::AppController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/blog_basic/app_controller.rb

Direct Known Subclasses

BlogPostsController, TagsController

Instance Method Summary collapse

Instance Method Details

#current_userObject



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

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

#require_userObject



6
7
8
# File 'app/controllers/blog_basic/app_controller.rb', line 6

def require_user
  session[:user_id]
end

#signed_in?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'app/controllers/blog_basic/app_controller.rb', line 10

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