Skip to content
Browse files

merging two tokamak fixes

  • Loading branch information...
1 parent 4d8a844 commit 53927fe19328adb0a496ee4403fb43c03295d416 @guilhermesilveira guilhermesilveira committed May 24, 2011
Showing with 30 additions and 11 deletions.
  1. +10 −9 Gemfile
  2. +19 −0 lib/hypertemplate/hook/rails.rb
  3. +1 −2 lib/hypertemplate/hook/tilt.rb
View
19 Gemfile
@@ -4,12 +4,13 @@ source :rubygems
gem "json_pure", :require => "json/pure"
gem "nokogiri"
-# Other dependencies
-gem "ruby-debug" , :group => [:development, :test], :platforms => [:mri]
-gem "methodize" , :group => [:development, :test]
-gem "rack" , "~>1.1", :group => [:development, :test]
-gem "rack-test" , :require => "rack/test", :group => [:development, :test]
-gem "rack-conneg", :require => "rack/conneg", :group => [:development, :test]
-gem "tilt" , "~>1.2", :group => [:development, :test]
-gem "sinatra" , "~>1.1", :group => [:development, :test]
-gem "rails" , ">=2.3.2", :group => [:development, :test]
+group :development, :test do
+ gem "ruby-debug" , :platforms => [:mri_18]
+ gem "ruby-debug19", :platforms => [:mri_19]
+ gem "rack" , "~>1.1"
+ gem "rack-test" , :require => "rack/test"
+ gem "rack-conneg", :require => "rack/conneg"
+ gem "tilt" , "~>1.2"
+ gem "sinatra" , "~>1.1"
+ gem "rails" , ">=2.3.2"
+end
View
19 lib/hypertemplate/hook/rails.rb
@@ -44,7 +44,26 @@ def compile(template)
end
end
+ module Rails3Adapter
+ def _pick_partial_template(path) #:nodoc:
+ return path unless path.is_a?(String)
+ prefix = controller_path unless path.include?(?/)
+ find_template(path, prefix, true).instance_eval do
+ unless respond_to?(:path)
+ def path; virtual_path end
+ end
+ self
+ 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:
View
3 lib/hypertemplate/hook/tilt.rb
@@ -25,12 +25,11 @@ def initialize(registry, view = nil, line = 1,options = {}, &block)
end
def initialize_engine
- return if defined?(::Hypertemplate)
require_template_library 'hypertemplate'
end
def prepare
- @media_type = options[:media_type]
+ @media_type = options[:media_type] || @options[:media_type]
raise Hypertemplate::BuilderError.new("Content type required to build representation.") unless @media_type
end

0 comments on commit 53927fe

Please sign in to comment.
Something went wrong with that request. Please try again.