lib/jammit/controller.rb in jammit-0.5.3 vs lib/jammit/controller.rb in jammit-0.5.4

- old
+ new

@@ -51,11 +51,11 @@ # request URL to the client, and cache a version with the timestamped cache # URL swapped in. def generate_stylesheets return @contents = Jammit.packager.pack_stylesheets(@package, @variant) unless @variant == :mhtml @mtime = Time.now - request_url = prefix_url(request.request_uri) + request_url = prefix_url(request.fullpath) cached_url = prefix_url(Jammit.asset_url(@package, @extension, @variant, @mtime)) css = Jammit.packager.pack_stylesheets(@package, @variant, request_url) @contents = css.gsub(request_url, cached_url) if perform_caching css end @@ -85,10 +85,10 @@ end # Make the Jammit::Controller available to Rails as a top-level controller. ::JammitController = Jammit::Controller -if defined?(Rails) && Rails.env.development? +if defined?(Rails) && (Rails.env.development? || Rails.env.test?) ActionController::Base.class_eval do append_before_filter { Jammit.reload! } end end