This project is archived and is in readonly mode.

#5921 ✓stale
John McDowall

Dynamic Layout by Method in Application Controller is broken in Rails 3.0.1

Reported by John McDowall | November 5th, 2010 @ 12:52 PM

I'm using the following in my ApplicationController:

layout :determine_layout

def determine_layout
   Logger.Debug "Processing layout"
   if devise_controller?
     @domain = Domain.find_by_domainName(request.domain)

Which used to work fine in Rails 3.0, until I upgraded to Rails 3.0.1. Now controllers do not have any layout and show a "You specified nil as the layout, but no such method was found" error. The debug message is never displayed.

If I replace layout :determine_layout with layout "admin" the error message goes away, but obviously all controllers then have the Admin layout applied incorrectly.

Comments and changes to this ticket

  • John McDowall

    John McDowall November 5th, 2010 @ 03:52 PM

    Solved. Was using except elsewhere which caused the other action methods not to use any layout.

  • Ryan Bigg

    Ryan Bigg November 8th, 2010 @ 01:50 AM

    • Importance changed from “” to “Low”

    Automatic cleanup of spam.

  • Santiago Pastorino

    Santiago Pastorino February 9th, 2011 @ 12:32 AM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 9th, 2011 @ 12:32 AM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket