{"issue":{"created_at":"2011-12-14T01:50:47Z","state":"open","updated_at":"2011-12-14T03:37:01Z","user":{"gravatar_id":"95631b02ca66cdaa8e3f4c434d9a7b3b","id":74291,"url":"https://api.github.com/users/framerate","avatar_url":"https://secure.gravatar.com/avatar/95631b02ca66cdaa8e3f4c434d9a7b3b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"framerate"},"comments":2,"body":"I'm new to backbone, so I could be missing something. But I have something like:\r\n\r\nvar ChildClass = BaseClass.extend(\r\n{\r\n    initialize: function()\r\n    {\r\n        Backbone.Model.prototype.initialize.call(this);\r\n        alert(\"child init (should see parent init before this but you don't)!\");\r\n    }\r\n  \t\t\r\n}\r\n\r\n\r\nMaybe I'm going about this wrong? I've been coding all day so forgive me if so :). But why can't I call super.initialize this way?\r\n","assignee":null,"id":2546779,"labels":[],"number":785,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Unable to call super.initialize()","html_url":"https://github.com/documentcloud/backbone/issues/785","closed_at":null,"url":"https://api.github.com/repos/documentcloud/backbone/issues/785","milestone":null},"action":"created","comment":{"created_at":"2011-12-14T03:37:01Z","updated_at":"2011-12-14T03:37:01Z","user":{"gravatar_id":"95631b02ca66cdaa8e3f4c434d9a7b3b","id":74291,"url":"https://api.github.com/users/framerate","avatar_url":"https://secure.gravatar.com/avatar/95631b02ca66cdaa8e3f4c434d9a7b3b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"framerate"},"body":"Base class is something along the lines of:\r\n\r\n``` javascript\r\nvar BaseClass= Backbone.Model.extend({\r\n initialize: function() {\r\n   alert(\"this is the base class\");\r\n }\r\n});\r\n```\r\n\r\nAnd child:\r\n\r\n``` javascript\r\nvar ChildClass= BaseClass.extend({\r\n initialize: function() {\r\n   Backbone.Model.prototype.initialize.apply(this, arguments);\r\n   alert(\"child initialized!\");\r\n }\r\n});\r\n```\r\nI was under the impression that Models extend Backbone.Model, and their children would extend the BaseModel?\r\n\r\nThe example in the docs I believe was Note = Backbone.Model.extend and PrivateNote = Note.extend. \r\n\r\nDoes that make sense?\r\n\r\nI want to initialize my ChildModel by doing:\r\n\r\nvar c = new ChildModel();\r\n\r\nand see both alerts so I know both initialize functions were called. Just a layer of abstraction in my classes/models to keep everything clean.","id":3134901,"url":"https://api.github.com/repos/documentcloud/backbone/issues/comments/3134901"}}