<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -249,7 +249,9 @@ module Merb::RenderMixin
   #   raised if no layout was specified, and the default layouts were
   #   not found.
   def _get_layout(layout = nil)
-    layout = _layout.to_s if _layout    
+    if _layout &amp;&amp; !layout
+      layout = _layout.instance_of?(Symbol) &amp;&amp; self.respond_to?(_layout, true) ? send(_layout) : _layout
+    end
     layout = layout.to_s if layout
     
     # If a layout was provided, throw an error if it's not found</diff>
      <filename>lib/merb-core/controller/mixins/render.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,18 @@ module Merb::Test::Fixtures
     class RenderStringControllerLayout &lt; RenderString
       self._template_root = File.dirname(__FILE__) / &quot;alt_views&quot;
     end
+    
+    class RenderStringDynamicLayout &lt; RenderString
+      layout :determine_layout
+      
+      def alt_index
+        render &quot;the alt index&quot;
+      end
+      
+      def determine_layout
+        action_name.index('alt') == 0 ? 'alt' : 'custom'
+      end
+    end
 
     class RenderTemplate &lt; Testing
       </diff>
      <filename>spec/public/abstract_controller/controllers/render.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,11 @@ describe Merb::AbstractController, &quot; rendering plain strings&quot; do
     dispatch_should_make_body(&quot;RenderStringControllerLayout&quot;, &quot;Controller: the index&quot;)
   end
 
+  it &quot;should support rendering plain strings with dynamic layouts&quot; do
+    dispatch_should_make_body(&quot;RenderStringDynamicLayout&quot;, &quot;Custom: the index&quot;, :index)
+    dispatch_should_make_body(&quot;RenderStringDynamicLayout&quot;, &quot;Alt: the alt index&quot;, :alt_index)
+  end
+  
 end
 
 describe Merb::AbstractController, &quot; rendering templates&quot; do</diff>
      <filename>spec/public/abstract_controller/render_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3f0f4f410f29b14b9f72057fb91755fe402c6ef1</id>
    </parent>
  </parents>
  <author>
    <name>Mirko Froehlich</name>
    <email>mirko@digitalhobbit.com</email>
  </author>
  <url>http://github.com/wycats/merb-core/commit/6be99f54af744cc84d3403cff5e11086b7f7496b</url>
  <id>6be99f54af744cc84d3403cff5e11086b7f7496b</id>
  <committed-date>2008-02-17T07:52:08-08:00</committed-date>
  <authored-date>2008-02-16T00:10:12-08:00</authored-date>
  <message>Added support for dynamic layouts.

When a layout is specified as a symbol on the controller level, we now try to call
a method with that name to dynamically determine the layout. We fall back to
interpreting the symbol as the name of the layout if no method with that name exists.
This is mainly to support rendering a different layout based on request parameters,
for example mobile vs. web. See ticket #66.

Signed-off-by: Michael D. Ivey &lt;ivey@gweezlebur.com&gt;</message>
  <tree>d38d91a1a2a15554bb5d816e6783079790baefee</tree>
  <committer>
    <name>Michael D. Ivey</name>
    <email>ivey@gweezlebur.com</email>
  </committer>
</commit>
