As of 2.3.2 render started loading vim patch mode files
 ( '*.erb.orig' instead of  '*.erb' ):

How to reproduce: create *.erb.orig files in the appropriate view
directory:

rails 2.3.2 loads:

 app/views/articles/new.html.erb.orig

instead of:

 app/views/articles/new.html.erb

This is probably because of the way
ActiionView::ReloadableTemplate::ReloadablePath is implemented. The
keys it contains come from the relative path without the extension, so
it gets:

@paths[ 'sessions/logout.html.erb' ] =>  template # from
login.html.erb

and the same hash value gets overwritten:

@paths[ 'sessions/logout.html.erb' ] =>  template # from
login.html.erb.orig

The quick hack I made just reverses the file listing
(Dir.glob.sort.reverse), so the *.erb files come after the *.erb.orig
files, and replace those created from .orig files (patch below).


NOTE: The problem appeared in RSpec, which may load templates
differently than production/non rspec/unit test/console - that is why
I changed all 3 Dir.glob instances.


--- reloadable_template.rb.orig 2009-03-18 12:27:45.000000000 +0100
+++ reloadable_template.rb      2009-03-19 18:48:31.109227986 +0100
@@ -69,7 +69,7 @@

         # get all the template filenames from the dir
         def template_files_from_dir(dir)
-          Dir.glob(File.join(dir, '*'))
+          Dir.glob(File.join(dir, '*')).sort.reverse
         end
     end

--- template.rb.orig    2009-03-18 12:27:45.000000000 +0100
+++ template.rb 2009-03-19 18:51:29.281239443 +0100
@@ -78,7 +78,7 @@

       private
         def templates_in_path
-          (Dir.glob("#...@path}/**/*/**") | Dir.glob("#...@path}/
**")).each do |file|
+          (Dir.glob("#...@path}/**/*/**") | Dir.glob("#...@path}/
**")).sort.reverse.each do |file|
             yield create_template(file) unless File.directory?(file)
           end
         end


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to