# Rails loads wrong files

**URL:** <https://www.ruby-forum.com/t/rails-loads-wrong-files/163093>\
**Category:** Rails\
**Created:** [March 17, 2009, 11:08am UTC](https://www.ruby-forum.com/t/rails-loads-wrong-files/163093 "2009-03-17T11:08:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cobra050](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/3d9bf3/32.png) [@cobra050](https://www.ruby-forum.com/u/cobra050)\
**Post date:** [March 17, 2009, 11:08am UTC](https://www.ruby-forum.com/t/rails-loads-wrong-files/163093/1 "2009-03-17T11:08:15Z")

</div>

I run in to errors which I dont understand:  
I never get the newest version of code (xxx.html.erb) displayed, instead  
my editors backupfile (xxx.html.erb.bak) are loaded/run.

I run Rails v2.3.2 (I am new. How to install 2.0.2? “gem install rails”  
put 2.3.2. on my windows xp machine)

Situation:

1. In my app there are some files (xxx.html.erb) as it should be.  
These files above I have been written and edited with my editor (i.e.  
UltraEdit)  
/rails\_apps/coconut/app/views/flights/show.html.erb  
/rails\_apps/coconut/app/views/flights/\_new\_seat.html.erb  
/rails\_apps/coconut/app/views/flights/\_seat\_list.html.erb

2. The Editor saves backup files from the last version of the file with  
extension .bak, like (xxx.html.erb.bak):  
/rails\_apps/coconut/app/views/flights/show.html.erb.bak  
/rails\_apps/coconut/app/views/flights/\_new\_seat.html.erb.bak  
/rails\_apps/coconut/app/views/flights/\_seat\_list.html.erb.bak

3. When I make a mistake in coding, the error page displayed concerns  
the backup files (xxx.html.erb.bak), not the xxx.html.erb files!!!  
So I never get the newest version of code (xxx.html.erb) loaded nor  
displayed.

4. When there is a backup file (i.e.  
app/views/flights/show.html.erb.bak), Rails error page shows content of  
the backup file (xxx.thml.erb.bak), not of the current file  
(xxx.html.erb):

####### START #################

## 

## 

Errno::ENOENT in Flights#show

Showing app/views/flights/show.html.erb.bak where line #29 raised:

No such file or directory -  
C:/InstantRails/rails\_apps/coconut/app/views/flights/\_new\_seat.html.erb.bak

Extracted source (around line #29):

26:  
27: \<%= render :partial=\>“seat\_list”, :locals=\>{:seats=\>@flight.seats}  
%\>  
28:  
29: \<%= render :partial=\>“new\_seat”,  
:locals=\>{:seat=\>Seat.new(:flight\_id=\>@flight.id)} %\>  
30:  
31: \<%= link\_to ‘Edit’, edit\_flight\_path(@flight) %\> |  
32: \<%= link\_to ‘Back’, flights\_path %\>

## 

## 

####### END #################

1. When I have deleted the editors backup file, but the xxx.htm.erb file  
ist still here, I got the folowing error:

####### START #################

## 

## 

Error message: “Missing template flights/\_seat\_list.erb in view path  
app/views”  
…

## 

## 

####### END #################

1. Any ideas why Rails loads not the xxx.html.erb files?  
Is this located only on Rails v2.3.2?

---

<div class="post-metadata">

**Author:** ![cobra050](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/3d9bf3/32.png) [@cobra050](https://www.ruby-forum.com/u/cobra050)\
**Post date:** [March 17, 2009, 4:54pm UTC](https://www.ruby-forum.com/t/rails-loads-wrong-files/163093/2 "2009-03-17T16:54:10Z")

</div>

Mike J. wrote:

> 1. The Editor saves backup files from the last version of the file with  
> extension .bak, like (xxx.html.erb.bak):  
> /rails\_apps/coconut/app/views/flights/show.html.erb.bak

I have no idea why Rails is trying to use your backup files. Maybe it  
sees the “html.erb” and ignores the rest of the file name. That being  
said, if I had an editor that left trash backup files around in my  
project folder I would immediately look for a option to turn that  
“feature” off. If the editor didn’t have such an option, I would find  
another editor. Those backup files are completely unnecessary if you’re  
using a version control system. And, if you’re not using a version  
control system then your should be.
