Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#5921

I'm using the following in my ApplicationController:

layout :determine_layout

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

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.

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

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. John McDowall
    John McDowall

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

    November 5th, 2010 @ 03:52 PM

  2. Ryan Bigg
    Ryan Bigg
    • Importance changed from to Low

    Automatic cleanup of spam.

    November 8th, 2010 @ 01:50 AM

  3. Santiago Pastorino
    Santiago Pastorino
    • 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.

    February 9th, 2011 @ 12:32 AM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 9th, 2011 @ 12:32 AM