Rafael Magaña
2012-May-17 09:34 UTC
Rendering the partials and templates paths on top of them as HTML comments
The idea is to make a little bit easier to find the rendered partials and
templates when you start working in an existing project, I know we can see
the log but I want something easier, in the log you don''t know how the
partial looks like only the name. Right now I''m doing this:
In
https://github.com/rails/rails/blob/master/actionpack/lib/action_view/renderer/partial_renderer.rb#L308
I
add this:
content = layout.render(view, locals){ content } if layout
content.insert(0, "<!-- Partial Rendered: #{@path} -->\n") #
<<<<
content
And I get this:
http://d.pr/i/Og9X
but I''m looking for a better way to do it, and the main goal is to
submit a
patch if people think it''s worth it or maybe a little gem,
don''t know, I''d
like to have a config option in config/development.rb like this too:
config.action_view.render_template_paths = true
Of course, this is only useful to me in development mode.
Any ideas?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/QYFhJo4sJdAJ.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.
Nick Sutterer
2012-May-18 13:09 UTC
Re: Rendering the partials and templates paths on top of them as HTML comments
Hm overriding #render in PartialRenderer looks just right to me.
PartialRenderer.class_eval do
def render(*)
super + " Partial rendered.... "
end
end
Does that work?
On Thursday, May 17, 2012 11:34:11 AM UTC+2, Rafael Magaña
wrote:>
> The idea is to make a little bit easier to find the rendered partials and
> templates when you start working in an existing project, I know we can see
> the log but I want something easier, in the log you don''t know how
the
> partial looks like only the name. Right now I''m doing this:
>
> In
>
https://github.com/rails/rails/blob/master/actionpack/lib/action_view/renderer/partial_renderer.rb#L308
I
> add this:
>
> content = layout.render(view, locals){ content } if layout
> content.insert(0, "<!-- Partial Rendered: #{@path} -->\n")
# <<<<
>
> content
>
>
> And I get this:
>
> http://d.pr/i/Og9X
>
>
> but I''m looking for a better way to do it, and the main goal is to
submit
> a patch if people think it''s worth it or maybe a little gem,
don''t know,
> I''d like to have a config option in config/development.rb like
this too:
>
> config.action_view.render_template_paths = true
>
> Of course, this is only useful to me in development mode.
>
> Any ideas?
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/djTyRd0HV9AJ.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.