Which Rails Layout is Used after_filter
I need an after filter that will perform a query depending on what layout is chosen by the user for the current page.
Is there a way to see what lay开发者_高级运维out is being used before the page is rendered?
Thanks.
The after_filter
is executed after the page is rendered. In the after_filter
you can know which layout has been used, but it's too late if you need to run a query and include the output in the layout.
You should probably follow an other way. If your query is tied to a specific layout, then create an helper containing the query and call the helper in your template.
Otherwise, provide more context about your need and we can suggest a different approach.
精彩评论