dnagir/knockout-rails — Issue #3: Trying example
Author: amalagaura
Created: 2011-11-26 05:20:46+00:00
State: open

I try the example as follows:

class User extends ko.Model
@configure 'user' # This is enough to save the model RESTfully to `/pages/{id}` URL

And I get this generated javascript
```javascript
(function() {
var User;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };

User = (function() {

__extends(User, ko.Model);
users.js:7 Uncaught ReferenceError: ko is not defined

function User() {
User.__super__.constructor.apply(this, arguments);
}

User.configure('user');

return User;

})();

}).call(this);
```

And I get the error that ko is not defined, but knockout.js is loaded with it's dependencies. And when I do a ko or ko.model from the console, it is defined. is it because this is not waiting for all javascript resources to load before executing?
It's tough to show, so here is a screenshot.

http://i.imgur.com/99McT.png

Here is contents of application.js
```
//
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require knockout
```