title: How to understand runtime layout in Rails?
body: <pre><code>class ProductsController &lt; ApplicationController
    layout :products_layout
  
    def show
      @product = Product.find(params[:id])
    end
  
    private
      def products_layout
        @current_user.special? ? "special" : "products"
      end
  
  end
  </code></pre>
  
  <p>Here when is method <code>products_layout</code> getting executed? There's nowhere I can see that calls the method <code>products_layout</code> so how could the symbol <code>:products_layout</code> be defined? </p>