Class: ComatoseController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/comatose_controller.rb

Overview

The controller for serving cms content…

Instance Method Summary collapse

Instance Method Details

#showObject

Render a specific page



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/comatose_controller.rb', line 9

def show
  page_name, page_ext = get_page_path
  page = ComatosePage.find_by_path( page_name )
  status = nil
  if page.nil?
    page = ComatosePage.find_by_path( '404' )
    status = 404
  end
  # if it's still nil, well, send a 404 status
  if page.nil?
    render :nothing=>true, :status=>status
    #raise ActiveRecord::RecordNotFound.new("Comatose page not found ")
  else
    # Make the page access 'safe' 
    @page = Comatose::PageWrapper.new(page)
    # For accurate uri creation, tell the page class which is the active mount point...
    ComatosePage.active_mount_info = get_active_mount_point(params[:index])
    render :text=>page.to_html({'params'=>params.stringify_keys}), :layout=>get_page_layout, :status=>status
  end
end