Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
LoginSystem, Radiant::LegacyRoutes
Defined in:
app/controllers/application_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LoginSystem

included

Constructor Details

#initializeApplicationController

Returns a new instance of ApplicationController.



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

def initialize
  super
  @config = Radiant::Config
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



15
16
17
# File 'app/controllers/application_controller.rb', line 15

def cache
  @cache
end

#configObject

Returns the value of attribute config.



15
16
17
# File 'app/controllers/application_controller.rb', line 15

def config
  @config
end

Instance Method Details

#include_javascript(script) ⇒ Object



29
30
31
# File 'app/controllers/application_controller.rb', line 29

def include_javascript(script)
  @javascripts << script
end

#include_stylesheet(sheet) ⇒ Object



25
26
27
# File 'app/controllers/application_controller.rb', line 25

def include_stylesheet(sheet)
  @stylesheets << sheet
end

#rescue_action_in_public(exception) ⇒ Object



50
51
52
53
54
55
56
57
# File 'app/controllers/application_controller.rb', line 50

def rescue_action_in_public(exception)
  case exception
    when ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction, ActionController::RoutingError
      render :template => "site/not_found", :status => 404
    else
      super
  end
end

#template_nameObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/application_controller.rb', line 33

def template_name
  case self.action_name
  when 'index'
    'index'
  when 'new','create'
    'new'
  when 'show'
    'show'
  when 'edit', 'update'
    'edit'
  when 'remove', 'destroy'
    'remove'
  else
    self.action_name
  end
end