Rails 3.2 engine layouts

Hi,

Is any one able to answer a question I have relating to Rails 3.2 engine
layouts

I’ll paste below too;

I’m struggling to understand how Rails 3.2 applies layouts when using
mountable engines.

Scenario: I’m building an engine which itself has a dashboard view and
an
admin view for various admin functions. I want the dashboard to have its
layout overridable by the base application (if the user desires) but the
admin should always use its own layout.

Here’s what I have at the moment inside my engine;

application_controller.rb

module Myengine
class ApplicationController < ActionController::Base

admin/dashboard_controller.rb

module Myengine
class Admin::DashboardController < ApplicationController

now I have my engines application.html.erb apply a hideous Red
background
whilst the base applications application.html.erb uses a pleasant yellow
background so I can distinguish which application layout is being
applied.

In this situation, if I access the base application first I see my
yellow
background (from the base app) and if I go to both the engine and the
engines admin path the yellow background remains.

If I restart the server and access the engine first then I see the red
background for the engine and the engines admin path whilst the base
application shows the yellow background.

If I modify my admin/dashboard_controller.rb as follows;

module Myengine
class Admin::DashboardController < ApplicationController
layout ‘myengine/application’

which I would expect to only apply to the engine/admin controller - but
if
I restart the server and access the engine/admin path I see the red
background whilst the root view of the engine uses the base application
yellow layout.

If I restart the server again and access the root of the mounted engine
I
get the red background applied which remains on the engines admin path
too.

Aaaaarggggghhhhh!

Is it expected behaviour to have different layouts of the application
used
depending on which path of the application is accessed first? Surely
not??
I must be doing something wrong!

Cheers,

John.