Class: Scrivito::CmsDispatchController

Inherits:
ActionController::Metal
  • Object
show all
Includes:
ActionController::Redirecting, ControllerHelper
Defined in:
app/controllers/scrivito/cms_dispatch_controller.rb

Instance Method Summary collapse

Instance Method Details

#process(action) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/scrivito/cms_dispatch_controller.rb', line 8

def process(action)
  CmsEnv.new(env).load

  if obj_not_found? && editing_context.workspace_changed?
    redirect_to "/"
    return self.response
  end

  controller = target_controller(env)
  env["action_dispatch.request.path_parameters"]["controller"] = controller.controller_path

  if !obj_not_found? && action == 'index'
    action = loaded_obj.controller_action_name
  end

  env["action_dispatch.request.path_parameters"]["action"] = action

  self.response = controller.action(action).call(env)
end