Class: ApplicationController

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

Overview

Define methods which should be called with every request to your application or which should be callable from anywhere of your controllers

Preloading

  CBA will load all pages to <code>@top_pages</code>
  marked with 'show_in_menu' and orders them by
  'menu_order asc'. This pages will be displayed as a 'main-menu'
  (see views/home/menu/)

Helper Methods

— helper_method :top_pages

   Will load @top_pages (Pages shown in menu)

— helper_method :root_menu

   Will load @root_menu. SiteMenu.roots.first

— helper_method :draft_mode

   Is controller used in draft-mode? (Show postings and pages flaged as draft)

Setup content for buttons on top of page

— Configured in `applicaiton.yml`

  • helper_method :pivotal_tracker_project

  • helper_method :github_project

  • helper_method :twitter_name

  • helper_method :twitter_link

Direct Known Subclasses

AuthenticationsController, BlogsController, CommentsController, HomeController, InvitationsController, PageComponentsController, PageTemplatesController, PagesController, PostingsController, SearchController, SiteMenusController, UserGroupsController, UserNotificationsController, UsersController

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) is_current_user?(usr) Also known as: current_user?

Boolean true if current_user is usr

Parameters:

  • usr (User)
    • Is this user the current_user?

Returns:

  • (Boolean)

    Boolean true if current_user is usr



73
74
75
# File 'app/controllers/application_controller.rb', line 73

def is_current_user? usr
  return current_user && (current_user == usr)
end