I think I solved it. It needs 2 more files than I think it should...
but it's better than a N-level if/switch statement.

index.html.erb:

    <% content_for :page_title, "Support" %>

    <%= render :partial => "help_document_listing", :layout =>
"help_document_layout" %>

    <%= javascript_include_tag "controllers/supportController" %>

show.html.erb:

    <% content_for :page_title, "Support: #{@help_document.question}"
%>
    <% content_for :body_id, "normalBody" %>

    <%= render :partial => "help_document_view", :layout =>
"help_document_layout" %>

    <%= javascript_include_tag "controllers/supportController" %>

_help_document_layout.html.erb:

    <div id="help">
      <h2>Have a Question You Need Answered?</h2>

      <div id="helpCategories">
        <h3>Categories</h3>

        <ul>
          <li><%= link_to "Most Popular", support_path %></li>
          <%= render :partial => "help_category", :collection =>
@help_categories %>
        </ul>
      </div>

      <%= yield %>

      <p id="nevermind">
        <b>Can't find what you're looking for?</b><br/>
        <%= link_to "Contact our support team", contact_webpage_path
%>
        and we'll personally get back to you as quickly as we can.
      </p>
    </div>

This way the partial that belongs to 'index' or 'show' gets put into
the <%= yield %>, which is exactly what I had in mind.

My only beef with this solution is that you need to put the page's
content in a partial... when it would be better to put it on the page
itself. That's unfortunate.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to