[Rails] Another layout question - Layouts on a per method basis -
Layouts with AJAX
softwareengineer 99
softwareengineer99 at yahoo.com
Sun Feb 5 19:09:03 GMT 2006
I feel I am very close to understanding how layouts are used in Rails:
Q1. I know one can specify a "default" layout for all methods in a controller by specifying
layout 'my-default-layout'
How can this be overridden for individual methods so when those methods are called/executed, the overridden layout will be used. Is this possible?
Q2. With no "default" layout specified, I tried to use the following for a method:
render (:layout => 'custom-layout-for-method')
and
render_component(:action => 'login', :controller=>'member', :layout=>'custom-layout-for-method')
but the page is rendered with no layout. Can anyone please explain why no layout was used? How can I make it use a custom layout on a per method basis?
Q3. I am displaying paginated results for the list action of tags controller. This page already has a layout defined. Everything works fine. Now, I am interested in implementing the ajax_pagination_links (http://www.bigbold.com/snippets/posts/show/386). However since the layout has already been defined, every time I click on the page number, the entire page including the header is loaded again within my div. I cannot find how I can turn off the layout conditionally or alltogether only for subsequent calls.
Since my @resource_pages collection is retrieved in a method that has a layout defined "globally" how can I turn off the header for subsequent pages only? I hope I am making sense here.
Thank you for making me a part of this wonderful community.
Frank
---------------------------------
Yahoo! Mail - Helps protect you from nasty viruses.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060205/e89f314a/attachment.html
More information about the Rails
mailing list