summaryrefslogtreecommitdiff
path: root/app/controllers/content_controller.rb
blob: 0fa983259859b4204a8311ef3e41f8d91f7e9cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class ContentController < ApplicationController
  
  # This is the method that renders most of the the public content. It recieves
  # a :locale and a :page_path parameter through the params hash. It looks up 
  # the node with the corresponding unique_name attribute. The method doesn't
  # return a node though, the node is really a proxy object for pages. It 
  # returns the most recent page associated to this node instead.
  def render_page
    path = params[:page_path].join('/')
    
    @page = Node.find_page(path)
    
    # Replace with real 404
    unless @page
      render( 
        :file => File.join(RAILS_ROOT, 'public', '404.html'),
        :status => 404
      )
    end
    
  end
end