This project is archived and is in readonly mode.

#1818 ✓wontfix
smargarita

Wrong view rendered

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

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.

Comments and changes to this ticket

  • ronin-24128 (at lighthouseapp)

    ronin-24128 (at lighthouseapp) February 2nd, 2009 @ 10:36 PM

    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.

  • DHH

    DHH February 7th, 2009 @ 01:42 PM

    • Assigned user set to “Joshua Peek”
    • Milestone cleared.
  • Joshua Peek

    Joshua Peek February 7th, 2009 @ 05:07 PM

    • 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.

  • Repository

    Repository February 7th, 2009 @ 06:08 PM

    • State changed from “open” to “resolved”

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

  • Chris Barnett

    Chris Barnett February 7th, 2009 @ 10:22 PM

    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.

  • Joshua Peek

    Joshua Peek February 7th, 2009 @ 10:39 PM

    • State changed from “resolved” to “open”
  • Joshua Peek

    Joshua Peek February 7th, 2009 @ 11:08 PM

    • 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.

  • Andrew White

    Andrew White February 8th, 2009 @ 10:38 AM

    I've just added ticket #1909 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.

  • Hans de Graaff

    Hans de Graaff March 25th, 2009 @ 09:32 AM

    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 it seems that the fix Andrew mentions in his comment should already be applied to 2.3.2, but this problem still persists.

  • thedarkone

    thedarkone March 25th, 2009 @ 04:25 PM

    Hi Hans,

    what about master (past v2.3.2.1 tag)?

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages