public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fixed that template extensions would be cached development mode #4624 
[Stefan Kaes]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4189 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Thu Apr 06 11:08:31 -0700 2006
commit  496725022a09cd2100e1550745064fb5a6308ee4
tree    d5215d5669707ca056304ab06c5fed66ed0d6421
parent  8eb73f43e1f7eb6f7afa7838e64b259c81bc8a47
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *1.12.1* (April 6th, 2005)
0
 
0
+* Fixed that template extensions would be cached development mode #4624 [Stefan Kaes]
0
+
0
 * Update to Prototype 1.5.0_rc0 [Sam Stephenson]
0
 
0
 * Honor skipping filters conditionally for only certain actions even when the parent class sets that filter to conditionally be executed only for the same actions. #4522 [Marcel Molina Jr.]
...
157
158
159
 
 
 
 
 
160
161
162
...
312
313
314
315
316
317
318
319
320
321
322
323
 
 
 
 
 
324
325
326
...
345
346
347
348
 
349
350
351
...
370
371
372
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
374
375
...
157
158
159
160
161
162
163
164
165
166
167
...
317
318
319
 
 
 
 
 
 
 
 
 
320
321
322
323
324
325
326
327
...
346
347
348
 
349
350
351
352
...
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
0
@@ -157,6 +157,11 @@
0
     @@cache_template_loading = false
0
     cattr_accessor :cache_template_loading
0
 
0
+ # Specify whether file extension lookup should be cached.
0
+ # Should be +false+ for development environments. Defaults to +true+.
0
+ @@cache_template_extensions = true
0
+ cattr_accessor :cache_template_extensions
0
+
0
     # Specify whether local_assigns should be able to use string keys.
0
     # Defaults to +true+. String keys are deprecated and will be removed
0
     # shortly.
0
@@ -312,15 +317,11 @@
0
     end
0
 
0
     def pick_template_extension(template_path)#:nodoc:
0
- @@cached_template_extension[template_path] ||=
0
- if match = delegate_template_exists?(template_path)
0
- match.first.to_sym
0
- elsif erb_template_exists?(template_path): :rhtml
0
- elsif builder_template_exists?(template_path): :rxml
0
- elsif javascript_template_exists?(template_path): :rjs
0
- else
0
- raise ActionViewError, "No rhtml, rxml, rjs or delegate template found for #{template_path}"
0
- end
0
+ if @@cache_template_extensions
0
+ @@cached_template_extension[template_path] ||= find_template_extension_for(template_path)
0
+ else
0
+ find_template_extension_for(template_path)
0
+ end
0
     end
0
 
0
     def delegate_template_exists?(template_path)#:nodoc:
0
@@ -345,7 +346,7 @@
0
       if template_file_extension
0
         template_exists?(template_file_name, template_file_extension)
0
       else
0
- @@cached_template_extension[template_path] ||
0
+ cached_template_extension(template_path) ||
0
            %w(erb builder javascript delegate).any? do |template_type|
0
              send("#{template_type}_template_exists?", template_path)
0
            end
0
@@ -370,6 +371,21 @@
0
       def path_and_extension(template_path)
0
         template_path_without_extension = template_path.sub(/\.(\w+)$/, '')
0
         [ template_path_without_extension, $1 ]
0
+ end
0
+
0
+ def cached_template_extension(template_path)
0
+ @@cache_template_extensions && @@cached_template_extension[template_path]
0
+ end
0
+
0
+ def find_template_extension_for(template_path)
0
+ if match = delegate_template_exists?(template_path)
0
+ match.first.to_sym
0
+ elsif erb_template_exists?(template_path): :rhtml
0
+ elsif builder_template_exists?(template_path): :rxml
0
+ elsif javascript_template_exists?(template_path): :rjs
0
+ else
0
+ raise ActionViewError, "No rhtml, rxml, rjs or delegate template found for #{template_path}"
0
+ end
0
       end
0
 
0
       # This method reads a template file.
...
14
15
16
 
17
18
19
...
14
15
16
17
18
19
20
0
@@ -14,6 +14,7 @@
0
 # Show full error reports and disable caching
0
 config.action_controller.consider_all_requests_local = true
0
 config.action_controller.perform_caching = false
0
+config.action_view.cache_template_extensions = false
0
 config.action_view.debug_rjs = true
0
 
0
 # Don't care if the mailer can't send

Comments

    No one has commented yet.