However if you find that you have to build wrapper pages around the front of your application, then you can do a lot worse than use the tools of ERB, et al to reduce the duplication.
What I've used is a HomeController that looks like this:
# Static page generator
class HomeController < ApplicationController
caches_page :index, :donation
end
with a couple of routes at the bottom of
routes.rbmap.home '', :controller => 'home', :action => 'index'
map.connect '/:action/:id', :controller => 'home'
Now you merely create the views you require in
views/home and add the name to the caches_page command.Rails will then generate the static pages on first access for anything that doesn't have a more specific controller and has a view, and a 404 error for anything else.
0 comments:
Post a Comment