Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Set "SprocketsApplication.use_page_caching = false" to prevent the Sp…

…rocketsController#show concatenation from being written to disk when config.action_controller.perform_caching is true
  • Loading branch information...
commit 6fcb7bfda3818d0e717758895be9a364bf546f1e 1 parent fb2fa55
@sstephenson authored
Showing with 4 additions and 1 deletion.
  1. +3 −0  lib/sprockets_application.rb
  2. +1 −1  lib/sprockets_controller.rb
View
3  lib/sprockets_application.rb
@@ -1,4 +1,7 @@
module SprocketsApplication
+ mattr_accessor :use_page_caching
+ self.use_page_caching = true
+
class << self
def routes(map)
map.resource(:sprockets)
View
2  lib/sprockets_controller.rb
@@ -1,5 +1,5 @@
class SprocketsController < ActionController::Base
- caches_page :show
+ caches_page :show, :if => Proc.new { SprocketsApplication.use_page_caching }
def show
render :text => SprocketsApplication.source, :content_type => "text/javascript"

1 comment on commit 6fcb7bf

@svenfuchs

Comparing the commit message ("when config.action_controller.perform_caching is true") to the implementation shouldn't that be

:if => Proc.new { ActionController::Base.perform_caching && SprocketsApplication.use_page_caching }

or something like that? As in "don't ever cache in development mode cause we'd wtf the hell out of those poor guys"? As in "me"

;)

Please sign in to comment.
Something went wrong with that request. Please try again.