title: scoped access through account /user object in emberjs init: function()
body: <p>Assuming i have <strong>emberjs model/controller/views</strong> for <strong>account , project and task</strong>, and i want to scope access to the project and task through account, how do i do that in emberjs. I am looking at using <strong>'init'</strong> but the <strong>'init function' is called after all the other properties are set</strong>, so i don't know if it is still able to get a currentUser or create a default currentUser  and associate it with every ember object instance being created within the <strong>App namespace.</strong></p>
  
  <p><strong>In emberjs if i have this for instance</strong>:</p>
  
  <pre><code>App = Ember.Application.create({
  
    init: function() {
      this._super();
      this.setCurrentUser();
      //console.log(this.get("setCurrentUser")
    },
  
    setCurrentUser: function(json) {
      this.store.load(this.User, json);
      this.set('currentUser', this.User.find(json['id']));
    }
  });
  </code></pre>
  
  <p><strong>Will the emberjs code above mean that whenever any part of the App namespace eg App.project is being accessed, the currentUser will first be looked, thereby ensuring the project is scoped to User</strong>.</p>
  
  <p>To make it clearer, in rails for example, i will do the scope access this way:</p>
  
  <pre><code>   #account-scope in Rails?
    class ApplicationController &lt; ActionController::Base
      def current_account
        @current_account ||= current_user &amp;&amp; current_user.account
      end
    end
  
    #An imagined ProjectsController showing scoped access of project through account
    @projects = current_account.projects
    @project = current_account.projects.find(params[:id])
  </code></pre>
  
  <p>Thanks for your insight.</p>