This project is archived and is in readonly mode.

#1884 ✓wontfix
José Valim

ActionView::Base @_render_stack is not being filled on edge

Reported by José Valim | February 5th, 2009 @ 04:50 PM | in 2.x

I'm the developer of Rails Footnotes plugin and I need to know the location of the template being rendered.

I've put a debugger at the end of process method on ActionController::Base, and then called:

@template.template

Which returned nil, Since the template method give me the last object in the @render_stack variable, I've checked and I can't actually see where the @render_stack is being filled. It's always empty.

Comments and changes to this ticket

  • josh

    josh February 5th, 2009 @ 09:35 PM

    • State changed from “new” to “wontfix”

    Using @template always points the the current template being rendered. So after you return to the controller, no template is "currently" being render. It is only for use inside the template.

  • José Valim

    José Valim February 5th, 2009 @ 09:38 PM

    So there is any way on Rails 2.3, without monkey patching, to know which template was rendered? I need its filename... :)

  • josh

    josh February 5th, 2009 @ 10:05 PM

    We'll its hard to say "which template was rendered" since most templates rendered other nested templates. You probably don't want the "last" template cause that could be some partial, I guess your looking for the "first" rendered template, but that isn't directly known by AC.

  • José Valim

    José Valim February 5th, 2009 @ 10:07 PM

    Makes sense! :) What I want was usually kept in @_first_render, but it's long gone right?

  • josh

    josh February 5th, 2009 @ 10:11 PM

    Hrm, I was under the impression that was a testing only hack.

    Just curious why you need this. Then we should consider adding this as a public feature for controllers.

  • José Valim

    José Valim February 5th, 2009 @ 10:30 PM

    I use it in Rails Footnotes plugin. It adds some links at the end of each view, which makes possible to open your controller or your view file in your editor (Textmate, for example) with just one click. It also adds some debug information, as queries, filters, etc.

    I was using the template in @_first_render to get the view filename to create the link.

    Screenshot here:

    http://1.bp.blogspot.com/_CVPxcH...

    Github here:

    http://github.com/josevalim/rail...

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>

People watching this ticket

Pages