From 42823e517d7fc93850c5388f26ee3fe23a5a10eb Mon Sep 17 00:00:00 2001 From: Jeff Casimir Date: Sat, 8 Oct 2011 01:35:53 -0400 Subject: [PATCH] Removed now unused AllHelpers code --- lib/draper/all_helpers.rb | 50 --------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 lib/draper/all_helpers.rb diff --git a/lib/draper/all_helpers.rb b/lib/draper/all_helpers.rb deleted file mode 100644 index 2d46c8b..0000000 --- a/lib/draper/all_helpers.rb +++ /dev/null @@ -1,50 +0,0 @@ -module Draper - module AllHelpers - # Most of the black magic here thanks to Xavier Shay (@xshay) - # Provide access to helper methods from outside controllers and views, - # such as in Presenter objects. Rails provides ActionController::Base.helpers, - # but this does not include any of our application helpers. - def all_helpers - @all_helpers_proxy ||= begin - # Start with just the rails helpers. This is the same method used - # by ActionController::Base.helpers - # proxy = ActionView::Base.new.extend(_helpers) - proxy = ActionController::Base.helpers - - # url_for depends on _routes method being defined - proxy.instance_eval do - def _routes - Rails.application.routes - end - end - - # Import all named path methods - proxy.extend(Rails.application.routes.named_routes.module) - - # Load all our application helpers to extend - modules_for_helpers([:all]).each do |mod| - proxy.extend(mod) - end - - proxy.instance_eval do - def controller - #Object.controller - end - end - - proxy.instance_eval do - # A hack since this proxy doesn't pick up default_url_options from anywhere - def url_for(*args) - if args.last.is_a?(Hash) && !args.last[:only_path] - args = args.dup - args << args.pop.merge('host' => ActionMailer::Base.default_url_options[:host]) - end - super(*args) - end - end - - proxy - end - end - end -end \ No newline at end of file