<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,2 @@
 ActionController::Base.send :include, InheritableTemplates::Controller
-ActionView::PartialTemplate.send :include, InheritableTemplates::PartialTemplate
+ActionView::Partials.send   :include, InheritableTemplates::Partials</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,50 +1,38 @@
 module InheritableTemplates
-  
+
+  # abstracts the process of finding an existing template up the controller inheritance chain
+  def self.find_inherited_template(controller, template_basename)
+    k = controller.class
+    while (k = k.superclass) &lt; ActionController::Base
+      template_name = &quot;#{k.controller_path}/#{template_basename}&quot;
+      return template_name if controller.send :template_exists?, template_name
+    end
+  end
+
+  # extends ActionController::Base
   module Controller
     def self.included base
       base.alias_method_chain :default_template_name, :inheritance
-      super
     end
   
-    def default_template_name_with_inheritance *args
-      name = default_template_name_without_inheritance *args
-      return name if template_exists? name
-      k = self.class
-      super_name = nil
-      while !super_name &amp;&amp; (k = k.superclass) &lt; ActionController::Base
-        s = k.name.underscore.sub(/_controller$/, &quot;/&quot; + name.split('/').last) 
-        (super_name = s) and next if template_exists? s
-      end
-      super_name || name
+    def default_template_name_with_inheritance(action_name = self.action_name)
+      template_name = default_template_name_without_inheritance(action_name)
+      return template_name if template_exists? template_name
+      InheritableTemplates.find_inherited_template(self, action_name) || template_name
     end
   end
-  
-  module PartialTemplate
-    def self.included base
-      base.alias_method_chain :initialize, :inheritance
-      base.alias_method_chain :set_path_and_variable_name!, :inheritance
-    end
 
-    def initialize_with_inheritance(view, partial_path, object = nil, locals = {})
-      @view = view
-      initialize_without_inheritance(view, partial_path, object, locals)
+  # extends ActionView::Partials
+  module Partials
+    def self.included base
+      base.alias_method_chain :partial_pieces, :inheritance
     end
 
-    def set_path_and_variable_name_with_inheritance!(partial_path)
-      return set_path_and_variable_name_without_inheritance!(partial_path) if partial_path.include?('/') || !@view_controller
-
-      @variable_name = partial_path
-      k = @view_controller.class
-      while k &lt; ActionController::Base
-        tentative_path = &quot;#{k.controller_path}/_#{@variable_name}&quot;
-        break @path = tentative_path if @view.view_paths.template_exists?(@view.send(:template_file_from_name, tentative_path))
-        k = k.superclass
-      end
-      @path ||= &quot;#{@view_controller.controller_path}/_#{@variable_name}&quot;
-
-      @variable_name = @variable_name.sub(/\..*$/, '').to_sym
+    def partial_pieces_with_inheritance(partial_path)
+      vname, path = partial_pieces_without_inheritance(partial_path)
+      return vname, path unless !partial_path.include?('/') &amp;&amp; respond_to?(:controller) &amp;&amp; !file_exists?(path)
+      [vname, (InheritableTemplates.find_inherited_template(controller, &quot;_#{vname}&quot;) || path)]
     end
-
   end
   
 end</diff>
      <filename>lib/inheritable_templates.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>208013d998f3809d1bd1ee13fb77cdb7ac9685a1</id>
    </parent>
  </parents>
  <author>
    <name>Caio Chassot</name>
    <email>dev@caiochassot.com</email>
  </author>
  <url>http://github.com/kch/inheritable_templates/commit/6ab5770ff14da9c574f795d99b9eb30bc342287b</url>
  <id>6ab5770ff14da9c574f795d99b9eb30bc342287b</id>
  <committed-date>2008-07-13T17:57:49-07:00</committed-date>
  <authored-date>2008-07-13T16:31:22-07:00</authored-date>
  <message>make compatible with rails 2.1 edge at commit 73b34e9f75d33dc0709d4ad36c912bdbb8977994

also, lots of cleanup and added some minimal comments</message>
  <tree>9d1cfedba6dc2234effd87709d6409597ac628cc</tree>
  <committer>
    <name>Caio Chassot</name>
    <email>dev@caiochassot.com</email>
  </committer>
</commit>
