Permalink
Browse files

Added ActionController::Base.page_cache_extension for setting the pag…

…e cache file extension (the default is .html) #903 [Andreas]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1019 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 216b1b7 commit dfadbfd3dcff3897a20c16de68eedb93fc35c36a @dhh dhh committed Mar 27, 2005
Showing with 12 additions and 2 deletions.
  1. +3 −1 actionpack/CHANGELOG
  2. +9 −1 actionpack/lib/action_controller/caching.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Added ActionController::Base.page_cache_extension for setting the page cache file extension (the default is .html) #903 [Andreas]
+
* Fixed "bad environment variable value" exception caused by Safari, Apache, and Ajax calls #918
* Fixed that pagination_helper would ignore :params #947 [Sebastian Kanthak]
@@ -8,7 +10,7 @@
* Added :position option to link_to_remote/form_remote_tag that can be either :before, :top, :bottom, or :after and specifies where the return from the method should be inserted #952 [Matthew McCray/Sam Stephenson]
-* Added Effect.Highlight to prototype.js to do Yellow Fade Technique (of 37signals' fame) on any container #952 [Sam Stephenson/?]
+* Added Effect.Highlight to prototype.js to do Yellow Fade Technique (of 37signals' fame) on any container #952 [Sam Stephenson/courtenay]
* Added include_seconds option as the third parameter to distance_of_time_in_words which will render "less than a minute" in higher resolution ("less than 10 seconds" etc) #944 [thomas@fesch.at]
@@ -51,13 +51,21 @@ def self.append_features(base) #:nodoc:
#
# The cache directory should be the document root for the web server and is set using Base.page_cache_directory = "/document/root".
# For Rails, this directory has already been set to RAILS_ROOT + "/public".
+ #
+ # == Setting the cache extension
+ #
+ # By default, the cache extension is .html, which makes it easy for the cached files to be picked up by the web server. If you want
+ # something else, like .php or .shtml, just set Base.page_cache_extension.
module Pages
def self.append_features(base) #:nodoc:
super
base.extend(ClassMethods)
base.class_eval do
@@page_cache_directory = defined?(RAILS_ROOT) ? "#{RAILS_ROOT}/public" : ""
cattr_accessor :page_cache_directory
+
+ @@page_cache_extension = '.html'
+ cattr_accessor :page_cache_extension
end
end
@@ -91,7 +99,7 @@ def caches_page(*actions)
private
def page_cache_file(path)
name = ((path.empty? || path == "/") ? "/index" : path)
- name << '.html' unless (name.split('/').last || name).include? '.'
+ name << @@page_cache_extension unless (name.split('/').last || name).include? '.'
return name
end

0 comments on commit dfadbfd

Please sign in to comment.