title: JavaScript error: "is not a constructor"
body: <p>I'm using backbone.js along with jquery and underscore.js</p>
  
  <p>Here's some of my code (it doesn't do anything yet). The strange thing is that upon hitting the url "/#users" there isn't an error. The only time the error happens is when I then click to go to a different hash and then click back to go to "/#users". Here's part of my code, with the line that receives the error toward the end <code>Users = new Users();</code> the error says "Users is not a constructor":</p>
  
  <pre><code>var User = Backbone.Model.extend({
      url: function(){return 'api/user/id/' + this.id;}
  });
  
  var Users = Backbone.Collection.extend({
      model: User,
      url: function(){return 'api/users';},
      initialize: function() {
      }
  });
  
  var UsersView = Backbone.View.extend({
      initialize: function() {
          this.users = this.options.users;
          this.render();
      },
  
      render: function() {
          _(this.users).each(function(){
          //  $('#app').append('here');
          });
  
          var template = _.template($('#usersTemplate').text());
  
          $(this.el).html(template({users: this.users}));
          $('#app').html(this.el);
      }
  });
  
  var UserView = Backbone.View.extend({
      initialize: function() {
          this.user = this.options.user;
          this.render();
      },
  
      render: function() {
  
          var template = _.template("hello {{user.name}}");
  
          $(this.el).html(template({user: this.user.toJSON()}));
          $('#app').html(this.el);
      }
  });
  
  var Controller = Backbone.Controller.extend({
      routes: {
          'dashboard' : 'dashboard',
          'users' : 'showusers'
      },
  
      showuser: function(id) {
          UserList.fetch({
              success: function(){
                  new UserView({user: User});
              },
              error: function(){
                  alert('an error of sorts');
              }
          });
      },
  
      showusers: function() {
          Users = new Users();
          Users.fetch({
              success: function(Users) {
                  new UsersView({users: Users});
              },
              error: function() {
              }
          });
      },
  
      dashboard: function() {
          Users = new Users;
          Users.fetch({
              success: function() {
                  new UsersView({users: Users});
              },
              error: function() {
              }
          });
      }
  });
  
  $(document).ready(function(){
      var ApplicationController = new Controller;
      Backbone.history.start();
  });
  </code></pre>
  
  <p>the accompanying html if you're curious:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Administration Panel&lt;/title&gt;
  
      &lt;!-- Framework --&gt;
      &lt;script src="/javascripts/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="/javascripts/underscore.min.js"&gt;&lt;/script&gt;
      &lt;script src="/javascripts/backbone.js"&gt;&lt;/script&gt;
  
      &lt;!-- Application --&gt;
      &lt;script src="/javascripts/application.js"&gt;&lt;/script&gt;
  
      &lt;script id="usersTemplate" type="text/x-underscore-template"&gt;
          asdf
      &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div&gt;
  &lt;a href="#dashboard"&gt;Dashboard&lt;/a&gt;
  &lt;a href="#users"&gt;Users&lt;/a&gt;
  &lt;a href="#products"&gt;Products&lt;/a&gt;
  &lt;a href="#orders"&gt;Orders&lt;/a&gt;
  &lt;a href="#pages"&gt;Pages&lt;/a&gt;
  &lt;a href="#settings"&gt;Settings&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div id="app"&gt;&lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>