<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *SVN*
 
+* Add conditional options to caches_page method. [Paul Horsfall]
+
 * Move missing template logic to ActionView. [Pratik]
 
 * Introduce ActionView::InlineTemplate class. [Pratik]</diff>
      <filename>actionpack/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -78,10 +78,18 @@ module ActionController #:nodoc:
 
         # Caches the +actions+ using the page-caching approach that'll store the cache in a path within the page_cache_directory that
         # matches the triggering url.
+        #
+        # Usage:
+        #
+        #   # cache the index action
+        #   caches_page :index
+        #
+        #   # cache the index action except for JSON requests
+        #   caches_page :index, :if =&gt; Proc.new { |c| !c.request.format.json? }
         def caches_page(*actions)
           return unless perform_caching
-          actions = actions.map(&amp;:to_s)
-          after_filter { |c| c.cache_page if actions.include?(c.action_name) }
+          options = actions.extract_options!
+          after_filter({:only =&gt; actions}.merge(options)) { |c| c.cache_page }
         end
 
         private</diff>
      <filename>actionpack/lib/action_controller/caching/pages.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,8 @@ ActionController::Base.page_cache_directory = FILE_STORE_PATH
 ActionController::Base.cache_store = :file_store, FILE_STORE_PATH
 
 class PageCachingTestController &lt; ActionController::Base
-  caches_page :ok, :no_content, :found, :not_found
+  caches_page :ok, :no_content, :if =&gt; Proc.new { |c| !c.request.format.json? }
+  caches_page :found, :not_found
 
   def ok
     head :ok
@@ -127,6 +128,12 @@ class PageCachingTest &lt; Test::Unit::TestCase
       end
     end
   end
+  
+  def test_page_caching_conditional_options
+    @request.env['HTTP_ACCEPT'] = 'application/json'
+    get :ok
+    assert_page_not_cached :ok
+  end
 
   private
     def assert_page_cached(action, message = &quot;#{action} should have been cached&quot;)</diff>
      <filename>actionpack/test/controller/caching_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3f8d3cd04ff0bd7cbf70c11d49a3dc009dfa98a0</id>
    </parent>
  </parents>
  <author>
    <name>Paul Horsfall</name>
    <login>phorsfall</login>
    <email>horsfallp@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/14a40804a29a57ad05ca6bffbe1e5334089593a9</url>
  <id>14a40804a29a57ad05ca6bffbe1e5334089593a9</id>
  <committed-date>2008-04-19T14:21:34-07:00</committed-date>
  <authored-date>2008-04-19T14:19:47-07:00</authored-date>
  <message>Add conditional options to caches_page method [#25 state:resolved]
Signed-off-by: Joshua Peek &lt;josh@joshpeek.com&gt;</message>
  <tree>80e2d5f38334327a70a368cc2e57fc8c2e8f7c1c</tree>
  <committer>
    <name>Joshua Peek</name>
    <login>josh</login>
    <email>josh@joshpeek.com</email>
  </committer>
</commit>
