Dynamic creation of layouts at runtime

I've learned how to dynamically change which layout is used at
runtime, but I now have a question of whether it is possible to create
new layouts (or modify existing ones) at runtime and have the app
automatically recognize those changes? If so could you point me to an
example or explain how it would be done.

Have you ever tried using partials? Partials can work you wonders. You need to have several partials (with varied layouts as you wish) and have one main view that calls them and switch them depending on a given condition. I have a similar situation in some apps I work on. I give users different “dashborad” layouts depending on their roles.

Let me give you a practical example:

<%= render :partial => "details" %>
<% if @super_user || @doctor || @nurse%>
  <%= render :partial => "simple_graph",
    :locals=>{:fields=>@patient}  rescue nil%>
<%end%>

<%= render :partial => "patient_visit_summary" %>
<%if @doctor%> <%= render :partial => "doctors_menu" %> <%elsif @clinician%> <%= render :partial => "clinicians_menu" %>
<%<%elsif @nurse%>
  <%= render :partial => "nurses_menu" %>
<%<%elsif @registration_clerk%>
  <%= render :partial => "clerks_menu" %>

<%elsif @super_user%>
  <%= render :partial => "super_users_menu" %>
<%end %>

Please let us know if it works for you.