<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,5 @@
+* Allow caches_action to accept a layout option [Jos&#233; Valim]
+
 * Added Rack processor [Ezra Zygmuntowicz, Josh Peek]
 
 </diff>
      <filename>actionpack/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -40,6 +40,8 @@ module ActionController #:nodoc:
     #         controller.send(:list_url, c.params[:id]) }
     #   end
     #
+    # If you pass :layout =&gt; false, it will only cache your action content. It is useful when your layout has dynamic information.
+    #
     module Actions
       def self.included(base) #:nodoc:
         base.extend(ClassMethods)
@@ -54,7 +56,8 @@ module ActionController #:nodoc:
         def caches_action(*actions)
           return unless cache_configured?
           options = actions.extract_options!
-          around_filter(ActionCacheFilter.new(:cache_path =&gt; options.delete(:cache_path)), {:only =&gt; actions}.merge(options))
+          cache_filter = ActionCacheFilter.new(:layout =&gt; options.delete(:layout), :cache_path =&gt; options.delete(:cache_path))
+          around_filter(cache_filter, {:only =&gt; actions}.merge(options))
         end
       end
 
@@ -81,7 +84,9 @@ module ActionController #:nodoc:
           if cache = controller.read_fragment(cache_path.path)
             controller.rendered_action_cache = true
             set_content_type!(controller, cache_path.extension)
-            controller.send!(:render_for_text, cache)
+            options = { :text =&gt; cache }
+            options.merge!(:layout =&gt; true) if cache_layout?
+            controller.send!(:render, options)
             false
           else
             controller.action_cache_path = cache_path
@@ -90,7 +95,8 @@ module ActionController #:nodoc:
 
         def after(controller)
           return if controller.rendered_action_cache || !caching_allowed(controller)
-          controller.write_fragment(controller.action_cache_path.path, controller.response.body)
+          action_content = cache_layout? ? content_for_layout(controller) : controller.response.body
+          controller.write_fragment(controller.action_cache_path.path, action_content)
         end
 
         private
@@ -105,6 +111,14 @@ module ActionController #:nodoc:
           def caching_allowed(controller)
             controller.request.get? &amp;&amp; controller.response.headers['Status'].to_i == 200
           end
+
+          def cache_layout?
+            @options[:layout] == false
+          end
+
+          def content_for_layout(controller)
+            controller.response.layout &amp;&amp; controller.response.template.instance_variable_get('@content_for_layout')
+          end
       end
 
       class ActionCachePath</diff>
      <filename>actionpack/lib/action_controller/caching/actions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -156,6 +156,7 @@ class ActionCachingTestController &lt; ActionController::Base
   caches_action :show, :cache_path =&gt; 'http://test.host/custom/show'
   caches_action :edit, :cache_path =&gt; Proc.new { |c| c.params[:id] ? &quot;http://test.host/#{c.params[:id]};edit&quot; : &quot;http://test.host/edit&quot; }
   caches_action :with_layout
+  caches_action :layout_false, :layout =&gt; false
 
   layout 'talk_from_action.erb'
 
@@ -181,6 +182,7 @@ class ActionCachingTestController &lt; ActionController::Base
   alias_method :show, :index
   alias_method :edit, :index
   alias_method :destroy, :index
+  alias_method :layout_false, :with_layout
 
   def expire
     expire_action :controller =&gt; 'action_caching_test', :action =&gt; 'index'
@@ -263,6 +265,19 @@ class ActionCacheTest &lt; Test::Unit::TestCase
     assert_equal @response.body, read_fragment('hostname.com/action_caching_test/with_layout')
   end
 
+  def test_action_cache_with_layout_and_layout_cache_false
+    get :layout_false
+    cached_time = content_to_cache
+    assert_not_equal cached_time, @response.body
+    assert fragment_exist?('hostname.com/action_caching_test/layout_false')
+    reset!
+
+    get :layout_false
+    assert_not_equal cached_time, @response.body
+
+    assert_equal cached_time, read_fragment('hostname.com/action_caching_test/layout_false')
+  end
+
   def test_action_cache_conditional_options
     @request.env['HTTP_ACCEPT'] = 'application/json'
     get :index</diff>
      <filename>actionpack/test/controller/caching_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>aa1771668877f20ca044e8f45a9736fbb7c8402e</id>
    </parent>
  </parents>
  <author>
    <name>josevalim</name>
    <email>jose.valim@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/d54d90f2b590c763fe710482a9b993923fe03ec0</url>
  <id>d54d90f2b590c763fe710482a9b993923fe03ec0</id>
  <committed-date>2008-06-03T12:02:51-07:00</committed-date>
  <authored-date>2008-06-03T12:02:51-07:00</authored-date>
  <message>Allow caches_action to accept a layout option [#198 state:resolved]
Signed-off-by: Joshua Peek &lt;josh@joshpeek.com&gt;</message>
  <tree>99b293aa7c115d9d083f6f42280d8438faa5fe4a</tree>
  <committer>
    <name>Joshua Peek</name>
    <email>josh@joshpeek.com</email>
  </committer>
</commit>
