Class: ApplicationController

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

Overview

The filters added to this controller will be run for all controllers in the application. Likewise will all the methods added be available for all controllers.

Direct Known Subclasses

AdminController, FileController, WikiController

Constant Summary collapse

FILE_TYPES =
{
  '.exe' => 'application/octet-stream',
  '.gif' => 'image/gif',
  '.jpg' => 'image/jpeg',
  '.pdf' => 'application/pdf',
  '.png' => 'image/png',
  '.txt' => 'text/plain',
  '.zip' => 'application/zip'
}

Class Method Summary collapse

Class Method Details

.wikiObject



17
18
19
# File 'app/controllers/application.rb', line 17

def self.wiki
  $instiki_wiki_service
end

.wiki=(the_wiki) ⇒ Object

For injecting a different wiki model implementation. Intended for use in tests



9
10
11
12
13
14
15
# File 'app/controllers/application.rb', line 9

def self.wiki=(the_wiki)
  # a global variable is used here because Rails reloads controller and model classes in the 
  # development environment; therefore, storing it as a class variable does not work
  # class variable is, anyway, not much different from a global variable
  $instiki_wiki_service = the_wiki
  logger.debug("Wiki service: #{the_wiki.to_s}")
end