<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>controller | Spiffy Stores Blog</title>
	<atom:link href="https://www.spiffystores.com.au/blog/tag/controller/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.spiffystores.com.au/blog</link>
	<description>Checkout - The Spiffy Stores Blog</description>
	<lastBuildDate>Tue, 31 Aug 2021 21:17:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
<site xmlns="com-wordpress:feed-additions:1">241205771</site>	<item>
		<title>Problems rendering a layout in Rails3</title>
		<link>https://www.spiffystores.com.au/blog/2013/01/04/problems-rendering-a-layout-in-rails3/</link>
		
		<dc:creator><![CDATA[Brian]]></dc:creator>
		<pubDate>Fri, 04 Jan 2013 04:49:43 +0000</pubDate>
				<category><![CDATA[Geek stuff]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[initialize]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails 3]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[super]]></category>
		<guid isPermaLink="false">https://www.spiffystores.com.au/blog/?p=1883</guid>

					<description><![CDATA[<p>From time to time we like to share technical tips when we&#8217;ve uncovered a solution to a problem that might help other Rails developers. Spiffy Stores is written using the Ruby on Rails framework, and we encountered a glitch with &#8230; <a href="https://www.spiffystores.com.au/blog/2013/01/04/problems-rendering-a-layout-in-rails3/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
The post <a href="https://www.spiffystores.com.au/blog/2013/01/04/problems-rendering-a-layout-in-rails3/">Problems rendering a layout in Rails3</a> first appeared on <a href="https://www.spiffystores.com.au/blog">Spiffy Stores Blog</a>.]]></description>
										<content:encoded><![CDATA[<div style='display:none;' class='shareaholic-canvas' data-app='share_buttons' data-title='Problems rendering a layout in Rails3' data-link='https://www.spiffystores.com.au/blog/2013/01/04/problems-rendering-a-layout-in-rails3/' data-app-id-name='category_above_content'></div>
<p>From time to time we like to share technical tips when we&#8217;ve uncovered a solution to a problem that might help other Rails developers.</p>



<p>Spiffy Stores is written using the Ruby on Rails framework, and we encountered a glitch with the Rails3 layouts. Basically we couldn&#8217;t get the layout to display, even though all the syntax was correct. Others have experienced this sort of problem. See <a href="http://stackoverflow.com/questions/6605716/cant-render-layout-in-rails-3" target="_blank" rel="noopener">http://stackoverflow.com/questions/6605716/cant-render-layout-in-rails-3</a> for an example.</p>



<p>After lots of digging around and tracing, the answer became clear. The AbstractController::Layouts module has an initialize method, but this method was not being called when a new controller was created.</p>



<p>If you experience this problem, then check any modules that you have included in your controller, as one of them has an initialize method that doesn&#8217;t call &#8216;super&#8217;.</p>



<p>If an included module needs an initialize method, then it needs to follow this pattern:</p>



<pre class="wp-block-code"><code lang="ruby" class="language-ruby">def initialize(*)
  # Module initialization code here
  super
end</code></pre>



<p>If the call to &#8216;super&#8217; isn&#8217;t included, then the initialization chain stops, and your controller won&#8217;t be properly initialized. You can find out all the included modules for a controller by executing this code from the console:</p>



<pre class="wp-block-code"><code lang="ruby" class="language-ruby">MyController.ancestors</code></pre>
<div style='display:none;' class='shareaholic-canvas' data-app='share_buttons' data-title='Problems rendering a layout in Rails3' data-link='https://www.spiffystores.com.au/blog/2013/01/04/problems-rendering-a-layout-in-rails3/' data-app-id-name='category_below_content'></div><div style='display:none;' class='shareaholic-canvas' data-app='recommendations' data-title='Problems rendering a layout in Rails3' data-link='https://www.spiffystores.com.au/blog/2013/01/04/problems-rendering-a-layout-in-rails3/' data-app-id-name='category_below_content'></div>The post <a href="https://www.spiffystores.com.au/blog/2013/01/04/problems-rendering-a-layout-in-rails3/">Problems rendering a layout in Rails3</a> first appeared on <a href="https://www.spiffystores.com.au/blog">Spiffy Stores Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1883</post-id>	</item>
	</channel>
</rss>
