Multiple "layout" declarations don't work as one might expect:
class UsersController < ApplicationController
layout "one", :only => [:this, :that]
layout "two", :except => [:this, :that]
end
should intuitively make the "one" layout apply to the "this" and "that" actions and the "two" layout to all others. This would be in line with how before_filter etc work.
It does not work, however. Having multiple "layout" declarations messes things up (in various ways depending on options, it seems).
I think preferably, multiple layout declarations should work alongside each other. In case they overlap, e.g.
layout "one", :only => [:this, :that]
layout "two", :only => [:that, :the_other]
then the last declaration should have precedence: so in this case, the "one" layout should apply to "this"; the "two" layout should apply to "that" and "the_other".
Not entirely sure if this should be a "defect" or "enhancement". Going with "defect" as I find it inconsistent and counter-intuitive.
No patch, alas. Might look into it if I find the time, but I thought I should at least report it in case someone more familiar with the code base wants to have a go.
I'm aware you can use procs/methods with "layout" to achieve the expected effect in the example above, but being able to use multiple declarations would be more intuitive and read better.
If core disagrees with this suggested behaviour, an alternative could be to throw a DoubleLayoutDeclarationError, analogous to DoubleRenderError, so people don't end up with multiple declarations silently producing weird results.