title: Ember call action on template load
body: <p>I have an ember app with a contacts page. I have a list of users which I want to filter according to a) a search query and b) filters saved on the session.currentUser model (using ember-simple-auth-devise).</p>
  
  <p>My route:</p>
  
  <pre><code>import Ember from 'ember';
  import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
  
  export default Ember.Route.extend(AuthenticatedRouteMixin).extend({
  model: function() {
      return this.store.find('user');
  },
  
  setupController: function(controller, model){
    this._super(controller, model);
  
    var currentUser = this.store.fetch('user', this.get('session').get('user_id'));
    // console.log(currentUser);
    controller.set('currentUser', currentUser);
  }
  });
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code>import Ember from 'ember';
  
  export default Ember.ArrayController.extend({
  
  searchText: '',
  
  filterUsers : function() {
      // Function to set the filteredUsers property, set in the route, based on the searchText
  
      var searchText = this.get('searchText'), regex = new RegExp(searchText, 'i');
  
  
      var us = this.get('model').filter(function(item) {
  
          // Run some filters here...
  
      });
  
      this.set('filteredUsers', us);
      return false;
  }.observes('searchText', 'model'),
  
  actions: {
      // Click the "Filter" button and update the server
      setFilters: function(){
          this.get('session').get('currentUser').save();
      }
  }
  });
  </code></pre>
  
  <p>This works up to a point - entering text in the searchText field runs my filters. However I have two issues that I can't resolve:</p>
  
  <ol>
  <li>How to I make the filterUsers function run when the template first loads, to use variables set on the currentUser model?</li>
  <li>How do I make filterUsers run when I call the setFilters method and change the current user?</li>
  </ol>
  
  <p>Many thanks</p>