I’m working on a site that has a lot of static and semi-static pages.
I’m using a StaticController to keep everything DRY and allow for erb
code in the pages when necessary:
class StaticController < ApplicationController
def display_page
begin
render(:template => “static/#{params[:path].join(’/’)}”)
rescue
render(:template => “static/404”, :status => 404)
end
end
def index
render(:template => “static/home”)
end
end
Some of these pages contain components (such as a news feed), which
I’ve been assured are Not A Good Thing. Instead, I’ve been told to use
partials and :before_filter to get the same results. However, in this
case, a :before_filter is not an option because there is only one
action to render all static pages. The only alternative seems to be
grabbing the data in the partial itself, which does not seem to be
proper separation. What should I do?