title: marionette region undefined following init
body: <p>The error ONLY occurs under a special routing circumstance when the layout (see gist link) is called by the router following a login processed in a different controller and routed here by the global event mechanism. </p>
  
  <p>Everything is fine as long as an existing session is reused and there is NO Logon processed. </p>
  
  <p>main code in <a href="https://gist.github.com/rowntreerob/8809779" rel="nofollow">this gist</a> ( error at line #113 "this.headerRegion" not defined</p>
  
  <p>Code blocks coming to the gist module , from logon and from router...</p>
  
  <pre><code>        loginSuccess: function (user) {
              vent.trigger('user:login'); //notify all widgets we have logged in
              app.router.navigate('home', { trigger: true });
          }
  ...
  
      return marionette.AppRouter.extend({
          routes: {
              'home' : 'home',
  ...
          },
  
          home: function() {
              this._showPage('home');
          },
  
  ...
          _showPage: function (pageName, options) {
              console.log("RouterShow " +pageName);
              var that = this;
              //make sure we are authenicated, if not go to login
              if (!Parse.User.current())
                  pageName = 'login';
  
              require(['./pages/' + pageName + '/Controller'], function (PageController) {
                  if (that.currentPageController) {
                      that.currentPageController.close();
                      that.currentPageController = null;
                  }
  // line below loads the layout in the gist link
                  that.currentPageController = new PageController(options);
  
                  that.currentPageController.show(app.regionMain)
                      .fail(function () {
                          //display the not found page
                          that.navigate('/not-found', { trigger: true, replace: true });
                      });
  
              });
          }
  ...
  
  define([
      'marionette',
      './Layout',
      'app'
  ], function (
      Marionette,
      Layout,
      app
  ) {
      'use strict';
  
      return Marionette.Controller.extend({
          show: function (region) {
              var that = this, d = new Marionette.$.Deferred();
              region.show(new Layout({ }));  //this layout in gist link
              return d.promise();
          }
      });
  });
  </code></pre>
  
  <p><code>pageController.show()</code> near the end of the above block calls the Layout region in the gist</p>
  
  <p>To recreate the error that ONLY OCCURs following a logon, I do the following:</p>
  
  <p>Show compoundView #1 at line #57 of the gist.</p>
  
  <p>click in compound view #1 firing event at line #40 of the gist ('<strong>roleList:getuser</strong>',)</p>
  
  <p>swap new views #2  into EXISTING regions used for the first views at lines #113, 114</p>
  
  <p>ERROR at 113, "this.headerRegion" no longer exists in the layout!</p>
  
  <p>Discussion - now IMO Layout extends Marionett.ItemView and from the source, it should always have the regions defined before calling init. The constructor checks for undef "this.headerRegion" at line #23 of the gist.</p>
  
  <p>My code reimplements the superclass constructor in lines 18 - 23 of the gist and it looks like "headerRegion" and "mainRegion" attributes are always defined. But, the error is :</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot call method 'show' of undefined
    Layout.js:113 Marionette.Layout.extend.getUserRelation</p>
  </blockquote>