<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,11 +1,20 @@
 module InheritableTemplates
+  
+  def self.template_exists?(controller, template_name)
+    begin
+      controller.view_paths.find_template(template_name, controller.send(:default_template_format))
+      true
+    rescue ActionView::MissingTemplate
+      false
+    end
+  end
 
   # 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
+      return template_name if template_exists?(controller, template_name)
     end
   end
 
@@ -17,7 +26,7 @@ module InheritableTemplates
   
     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
+      return template_name if InheritableTemplates.template_exists?(self, template_name)
       InheritableTemplates.find_inherited_template(self, action_name) || template_name
     end
   end
@@ -29,13 +38,14 @@ module InheritableTemplates
     end
 
     def _pick_partial_template_with_inheritance(partial_path)
-      _pick_template case
+      path = case
       when partial_path.include?('/') then File.join(File.dirname(partial_path), &quot;_#{File.basename(partial_path)}&quot;)
       when respond_to?(:controller) then
-        controller.send(:template_exists?, (p = &quot;#{controller.class.controller_path}/_#{partial_path}&quot;)) &amp;&amp; p ||
-          InheritableTemplates.find_inherited_template(controller, &quot;_#{partial_path}&quot;)
+        InheritableTemplates.template_exists?(controller, p = &quot;#{controller.class.controller_path}/_#{partial_path}&quot;) ?
+          p : InheritableTemplates.find_inherited_template(controller, &quot;_#{partial_path}&quot;)
       else &quot;_#{partial_path}&quot;
       end
+      self.view_paths.find_template(path, self.template_format)
     end
   end
   </diff>
      <filename>lib/inheritable_templates.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5a1362cd76e0b512920356896a5ad6e082e8ffb7</id>
    </parent>
  </parents>
  <author>
    <name>Caio Chassot</name>
    <email>dev@caiochassot.com</email>
  </author>
  <url>http://github.com/kch/inheritable_templates/commit/f9ac1a0e03354d0f6beb44cc6b66c41fcf5a6735</url>
  <id>f9ac1a0e03354d0f6beb44cc6b66c41fcf5a6735</id>
  <committed-date>2009-02-09T03:59:02-08:00</committed-date>
  <authored-date>2009-02-08T14:32:29-08:00</authored-date>
  <message>make compatible with rails 2.3 edge at commit 858a420ce18719c720b80508b336e37ce37a20bf</message>
  <tree>aab274cf1abe6a87eedf627636bb2041dafadcb3</tree>
  <committer>
    <name>Caio Chassot</name>
    <email>dev@caiochassot.com</email>
  </committer>
</commit>
