Skip to content

Instantly share code, notes, and snippets.

@darrenclark
Created September 3, 2011 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrenclark/1191636 to your computer and use it in GitHub Desktop.
Save darrenclark/1191636 to your computer and use it in GitHub Desktop.
Hack-job of a class to force Sprockets to rebuild assets every request
# Hack-job of a class to force Sprockets to rebuild assets every request
class NoCacheSprockets < Sprockets::Environment
# Bypass Sprockets::Environment's caching, and call Sprockets::Base's method directly
def find_asset(path, options = {})
self.class.superclass.superclass.instance_method(:find_asset).bind(self).call(path, options)
end
# Prevent any 304 responses (for the web browser's sake)
def not_modified?(asset,env)
false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment