I'm trying to use this technique (http://blog.hasmanythrough.com/2008/4/2/simple-pages) on "boiler-plate" pages I want to keep in a subdirectory of my controller's view folder.
How would I do this? The below doesn't seem to work: returns a "Template missing" error.
Error:
Missing template home/New_York_apartments.erb in view path app/views
/app
/controllers
home_controller.rb
/old_pages
home_controller.rb
/views
/home
about.html.haml
contact.html.haml
index.html.haml
/old_pages
New_York_apartments.html.haml
routes.rb
map.namespace :old_pages do
map.connect ':page', :controller => 'home', :action => 'show', :page => HomeController::PAGES
end
map.home ':page', :controller => 'home', :action => 'show', :page => HomeController::PAGES
controllers/home_controller.rb
class HomeController < ApplicationController
# boiler-plate pages
PAGES = ['about','contact']
def index
# homepage
end
def show
render :action => params[:page] # passed in our routes
end
end
controllers/old_pages/home_controller.rb
class OldPages::HomeController < ApplicationController
# boiler-plate pages
PAGES = [
'New_York_apartments' # apprently something to do with new york apartments; who knows
]
def show
render :action => params[:page] # passed in our routes
end
end