Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #action_view/helpers/asset_tag_helper.rb
- class AssetTag
- # NOTE: This 'Cache' stays around forever
- Cache = {}
- CacheGuard = Mutex.new
- def self.create(template, controller, source, include_host = true)
- CacheGuard.synchronize do
- key = if controller.respond_to?(:request)
- [self, controller.request.protocol,
- ActionController::Base.asset_host,
- ActionController::Base.relative_url_root,
- source, include_host]
- else
- [self, ActionController::Base.asset_host, source, include_host]
- end
- # NOTE Put EVERY asset tag (css,js, and all images) into a static cache
- Cache[key] ||= new(template, controller, source, include_host).freeze
- end
- end
Add Comment
Please, Sign In to add comment