From 91aaa29df845181b64e9053e421617da1706c027 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Sat, 10 Sep 2011 16:30:23 -0400 Subject: [PATCH] monkey patch to rails 3.1 image functions --- .../rails/actionpack31/helpers.rb | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/compass/app_integration/rails/actionpack31/helpers.rb b/lib/compass/app_integration/rails/actionpack31/helpers.rb index 633620a3..4c7998ca 100644 --- a/lib/compass/app_integration/rails/actionpack31/helpers.rb +++ b/lib/compass/app_integration/rails/actionpack31/helpers.rb @@ -3,3 +3,24 @@ module Sass::Script::Functions asset_url(path, Sass::Script::String.new("image")) end end + + +module Compass::RailsImageFuctionPatch + private + + def image_path(image_file) + if file = Rails.application.assets.find_asset(image_file) + return file + end + super(image_file) + end +end + +module Sass::Script::Functions + include Compass::RailsImageFuctionPatch +end + +# Wierd that this has to be re-included to pick up sub-modules. Ruby bug? +class Sass::Script::Functions::EvaluationContext + include Sass::Script::Functions +end \ No newline at end of file