Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix ActionView::TemplateHandler deprecation in Rails 3.2

  • Loading branch information...
commit c9353120951f521a0831215478582c7c3a60ac3b 1 parent cbcdb7a
@brunoadacosta brunoadacosta authored
Showing with 8 additions and 9 deletions.
  1. +8 −9 lib/hypertemplate/hook/rails.rb
View
17 lib/hypertemplate/hook/rails.rb
@@ -2,11 +2,11 @@
module Hypertemplate
module RegistryContainer
-
+
def hypertemplate_registry
@hypertemplate || use_hypertemplate
end
-
+
def use_hypertemplate(&block)
@hypertemplate = ::Hypertemplate::Registry.new
if block_given?
@@ -17,7 +17,7 @@ def use_hypertemplate(&block)
end
@hypertemplate
end
-
+
end
end
@@ -31,10 +31,9 @@ module Hypertemplate
module Hook
module Rails
- class Hypertemplate < ::ActionView::TemplateHandler
- include ::ActionView::TemplateHandlers::Compilable
+ class Hypertemplate
- def compile(template)
+ def self.call(template)
"@content_type_helpers = controller.hypertemplate_registry[self.response.content_type].helper; " +
"extend @content_type_helpers; " +
"extend Hypertemplate::Hook::Rails::Helpers; " +
@@ -56,14 +55,14 @@ def path; virtual_path end
end
end
end
-
+
module Helpers
def self.extend_object(base)
super
base.extend(Rails3Adapter) unless base.respond_to?(:_pick_partial_template)
end
-
+
# Load a partial template to execute in describe
#
# For example:
@@ -108,7 +107,7 @@ def partial(partial_path, caller_binding = nil)
end
private
-
+
def self.registry
if defined? ::ActionView::Template and ::ActionView::Template.respond_to?(:register_template_handler)
::ActionView::Template
Please sign in to comment.
Something went wrong with that request. Please try again.