Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
LoginSystem
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.



22
23
24
25
# File 'app/controllers/application_controller.rb', line 22

def initialize
  super
  @trusty_config = TrustyCms::Config
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



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

def cache
  @cache
end

#pagination_parametersObject (readonly)

Returns the value of attribute pagination_parameters.



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

def pagination_parameters
  @pagination_parameters
end

#trusty_configObject

Returns the value of attribute trusty_config.



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

def trusty_config
  @trusty_config
end

Instance Method Details

#rescue_action_in_public(exception) ⇒ Object



44
45
46
47
48
49
50
51
# File 'app/controllers/application_controller.rb', line 44

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



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/application_controller.rb', line 27

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