From 82f16e71d49350c1ad4aa48773db5d0f45a55c6c Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 2 Mar 2009 20:29:25 +0100 Subject: introducing page templates - need to add edit capabilities renamed the custom template folder forgot one fix for the new custom template path page templates refined renamed page attribute template to template_name as i suspected it to be a reserved word. it still didn't work until i discovered that simon defined the accessible attributes! That costed me 40 minutes of lifetime. But he apologized ;) tests for public and custom page templates --- app/controllers/content_controller.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'app/controllers/content_controller.rb') diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 0fa9832..706cfcd 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -10,8 +10,14 @@ class ContentController < ApplicationController @page = Node.find_page(path) - # Replace with real 404 - unless @page + if @page + template = @page.valid_template + + render( + :file => template, + :layout => true + ) + else render( :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404 -- cgit v1.3