Skip to content
This repository
Browse code

Eliminate an error from an implicit dependency on AV::Base

  • Loading branch information...
commit 9f92563892007c7f42a51ec7926352d50d596579 1 parent 7f53dca
Yehuda Katz authored March 19, 2010
4  actionpack/lib/action_view.rb
@@ -44,13 +44,15 @@ module ActionView
44 44
 
45 45
     autoload :Base
46 46
     autoload :LookupContext
47  
-    autoload :MissingTemplate,    'action_view/base'
48 47
     autoload :Resolver,           'action_view/template/resolver'
49 48
     autoload :PathResolver,       'action_view/template/resolver'
50 49
     autoload :FileSystemResolver, 'action_view/template/resolver'
51 50
     autoload :PathSet,            'action_view/paths'
52 51
 
  52
+    autoload :MissingTemplate,    'action_view/template/error'
  53
+    autoload :ActionViewError,    'action_view/template/error'
53 54
     autoload :TemplateError,     'action_view/template/error'
  55
+
54 56
     autoload :TemplateHandler,   'action_view/template'
55 57
     autoload :TemplateHandlers,  'action_view/template'
56 58
   end
21  actionpack/lib/action_view/base.rb
@@ -7,27 +7,6 @@ module ActionView #:nodoc:
7 7
   class NonConcattingString < ActiveSupport::SafeBuffer
8 8
   end
9 9
 
10  
-  class ActionViewError < StandardError #:nodoc:
11  
-  end
12  
-
13  
-  class MissingTemplate < ActionViewError #:nodoc:
14  
-    attr_reader :path
15  
-
16  
-    def initialize(paths, path, details, partial)
17  
-      @path = path
18  
-      display_paths = paths.compact.map{ |p| p.to_s.inspect }.join(", ")
19  
-      template_type = if partial
20  
-        "partial"
21  
-      elsif path =~ /layouts/i
22  
-        'layout'
23  
-      else
24  
-        'template'
25  
-      end
26  
-
27  
-      super("Missing #{template_type} #{path} with #{details.inspect} in view paths #{display_paths}")
28  
-    end
29  
-  end
30  
-
31 10
   # Action View templates can be written in three ways. If the template file has a <tt>.erb</tt> (or <tt>.rhtml</tt>) extension then it uses a mixture of ERb
32 11
   # (included in Ruby) and HTML. If the template file has a <tt>.builder</tt> (or <tt>.rxml</tt>) extension then Jim Weirich's Builder::XmlMarkup library is used.
33 12
   # If the template file has a <tt>.rjs</tt> extension then it will use ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.
24  actionpack/lib/action_view/template/error.rb
... ...
@@ -1,6 +1,26 @@
1 1
 require "active_support/core_ext/enumerable"
2 2
 
3 3
 module ActionView
  4
+  class ActionViewError < StandardError #:nodoc:
  5
+  end
  6
+
  7
+  class MissingTemplate < ActionViewError #:nodoc:
  8
+    attr_reader :path
  9
+
  10
+    def initialize(paths, path, details, partial)
  11
+      @path = path
  12
+      display_paths = paths.compact.map{ |p| p.to_s.inspect }.join(", ")
  13
+      template_type = if partial
  14
+        "partial"
  15
+      elsif path =~ /layouts/i
  16
+        'layout'
  17
+      else
  18
+        'template'
  19
+      end
  20
+
  21
+      super("Missing #{template_type} #{path} with #{details.inspect} in view paths #{display_paths}")
  22
+    end
  23
+  end
4 24
   class Template
5 25
     # The Template::Error exception is raised when the compilation of the template fails. This exception then gathers a
6 26
     # bunch of intimate details and uses it to report a very precise exception message.
@@ -73,11 +93,11 @@ def line_number
73 93
       end
74 94
 
75 95
       def to_s
76  
-        "\n#{self.class} (#{message}) #{source_location}:\n" + 
  96
+        "\n#{self.class} (#{message}) #{source_location}:\n" +
77 97
         "#{source_extract}\n    #{clean_backtrace.join("\n    ")}\n\n"
78 98
       end
79 99
 
80  
-      # don't do anything nontrivial here. Any raised exception from here becomes fatal 
  100
+      # don't do anything nontrivial here. Any raised exception from here becomes fatal
81 101
       # (and can't be rescued).
82 102
       def backtrace
83 103
         @backtrace

0 notes on commit 9f92563

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