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
(BigBold - Informasi Tentang Bisnis dan Marketing). 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