Rails loads wrong files


#1

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?

#2

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.