class Pettanr.User extends Backbone.Model defaults: { } initialize: (attr = {}, options = {}) -> super(attr, options) _.extend(this, Backbone.Events) if @id @url = @url + @id class Pettanr.User.Session extends Pettanr.User sign_in: () -> @save({}) save: (model_attr) -> @url = '/users/sign_in' super(model_attr, { success: (model, response, options) => @trigger('sign_in:success', model, response) error: (model, response, options) => @trigger('sign_in:fail', model, response) }) destroy: () -> @url = '/users/sign_out' @sync('delete', this, { success: (model, response, options) => @trigger('sign_out:success', model, response) error: (model, response, options) => @trigger('sign_out:fail', model, response) }) initialize: (attr = {}, options = {}) -> super(attr, options)