Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Wrong view rendered

#1818

In one of the /views folders of my application, among the .html.erb files there are:

  • show.html.erb
  • show.html.erbok (an old version of show.html.erb, rename with "erbok" extension)

When I run the "show" action in the controller, instead of rendering show.html.erb, show.html.erbok is rendered.

The show action is

def show @ust = User.find(params[:id]) end

If I delete show.html.erbok, all works fine and show.html.erb is rendered.

I am using Rails 2.2.2 on Mac OSX 10.5.

Reported by smargarita · January 29th, 2009 @ 01:13 PM

State: wontfix
Milestone: none
Assigned to: josh josh
Importance: none

Activity

  1. ronin-24128 (at lighthouseapp)
    ronin-24128 (at lighthouseapp)

    Confirmed with rails 2.2.2 and 2.3.0 on Ubuntu 8.10. I had form.html.haml and form.html.haml~ (old backup) in one of my views folders and I was wondering why my updates are not rendered even after restarting server. After deleting backup copy everything works fine.

    February 2nd, 2009 @ 10:36 PM

  2. DHH
    DHH
    • Assigned user set to josh
    • Milestone cleared.

    February 7th, 2009 @ 01:42 PM

  3. josh
    josh
    • State changed from new to open

    The problem is that unknown extension types fallback to erb rendering. I know a patch was submitted for this, but maybe they only really wanted ones with no extension to fallback to erb.

    February 7th, 2009 @ 05:07 PM

  4. Repository
    Repository
    • State changed from open to resolved

    (from [e4a7c0bb5b175e6eceb2fe808075d6122521237c]) ~ backup files don't clobber original templates [#1818 Wrong view rendered state:resolved] http://github.com/rails/rails/co...

    February 7th, 2009 @ 06:08 PM

  5. Chris Barnett
    Chris Barnett

    Looks like that commit may not have fixed the problem.

    See the attached patch, it just adds a "shared.html.erb~" file to actionpack's test fixtures, which causes existing tests to fail.

    Apologies for not doing something more positive, like writing a patch that works. I did try, but couldn't get my head around the template-finding code.

    February 7th, 2009 @ 10:22 PM

  6. josh
    josh
    • State changed from resolved to open

    February 7th, 2009 @ 10:39 PM

  7. josh
    josh
    • State changed from open to wontfix

    Sorry, but I don't think this is going to be fix fixable for 2.3.

    In 3.0 we can revisit this try to come up with a solid template choosing solution.

    February 7th, 2009 @ 11:08 PM

  8. Andrew White
    Andrew White

    I've just added ticket #1909 Improve view performance in development and reinstate template reloading in p... which should fix this problem along with some extra benefits. I'd be grateful if you could check it out and see if it fixes things for you.

    February 8th, 2009 @ 10:38 AM

  9. Hans de Graaff
    Hans de Graaff

    I've just run into this problem with the released version 2.3.2.

    With these files present:

    app/views/controller/view.html.erb app/views/controller/view.html.erb.~1~

    the latter (emacs backup file) is being picked up instead of being ignored like in rails 2.1.x and earlier versions. I have not tested with rails 2.2.x.

    Reading through #1909 Improve view performance in development and reinstate template reloading in p... it seems that the fix Andrew mentions in his comment should already be applied to 2.3.2, but this problem still persists.

    March 25th, 2009 @ 09:32 AM

  10. thedarkone
    thedarkone

    Hi Hans,

    what about master (past v2.3.2.1 tag)?

    March 25th, 2009 @ 04:25 PM