aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/sprockets/helpers
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2011-05-23 16:43:58 -0700
committerwycats <wycats@gmail.com>2011-05-23 16:45:26 -0700
commita9f22dc272ad5b7fe23b4648b825fd454ad230a3 (patch)
tree0c122b3e323769ecfb3c1223b3d876e389712ad4 /actionpack/lib/sprockets/helpers
parent76f947edf755f57ec721b412c6cef9a9c2c8f4b5 (diff)
downloadrails-a9f22dc272ad5b7fe23b4648b825fd454ad230a3.tar.gz
rails-a9f22dc272ad5b7fe23b4648b825fd454ad230a3.tar.bz2
rails-a9f22dc272ad5b7fe23b4648b825fd454ad230a3.zip
Move the last pockets of Sprockets stuff into the Sprockets directory
Diffstat (limited to 'actionpack/lib/sprockets/helpers')
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb21
1 files changed, 15 insertions, 6 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index 5f2854995f..3b64be67d9 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -1,3 +1,6 @@
+require "action_view/helpers/asset_paths"
+require "action_view/helpers/asset_tag_helper"
+
module Sprockets
module Helpers
module RailsHelper
@@ -9,12 +12,6 @@ module Sprockets
end
end
- def asset_path(source, default_ext = nil, body = false)
- source = source.logical_path if source.respond_to?(:logical_path)
- path = asset_paths.compute_public_path(source, 'assets', default_ext, true)
- body ? "#{path}?body=1" : path
- end
-
def javascript_include_tag(source, options = {})
debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
body = options.key?(:body) ? options.delete(:body) : false
@@ -53,6 +50,18 @@ module Sprockets
end
end
+ private
+ def debug_assets?
+ params[:debug_assets] == '1' ||
+ params[:debug_assets] == 'true'
+ end
+
+ def asset_path(source, default_ext = nil, body = false)
+ source = source.logical_path if source.respond_to?(:logical_path)
+ path = asset_paths.compute_public_path(source, 'assets', default_ext, true)
+ body ? "#{path}?body=1" : path
+ end
+
class AssetPaths < ActionView::Helpers::AssetPaths #:nodoc:
def compute_public_path(source, dir, ext=nil, include_host=true)
super(source, 'assets', ext, include_host)