Sha256: 9d43cce1aff7da0cb5b886580b4d38655ff8677e5ab298ecb0574529fadda29d

Contents?: true

Size: 655 Bytes

Versions: 4

Compression:

Stored size: 655 Bytes

Contents

#  * Require ./../underscore/underscore.string
#  * Require ./../underscore/underscore.inflection
#= require ./base

class Ultimate.Backbone.Model extends Backbone.Model

  constructor: ->
    Ultimate.Backbone.debug ".Model.constructor()", @
    super

  ready: (callback, context = @) ->
    if _.isEmpty(@attributes)
      @readyDeferred ||= $.Deferred()
      @readyDeferred.done =>
        callback.apply context, [@]
      @fetch success: (=> @readyDeferred.resolve()), silent: true
    else
      callback.apply context, [@]

  singular: ->
    _.singularize(_.string.underscored(constructor.name))
    (@className or @constructor.name or 'Model')

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ultimate-base-0.3.1.1 app/assets/javascripts/ultimate/backbone/model.js.coffee
ultimate-base-0.3.1 app/assets/javascripts/ultimate/backbone/model.js.coffee
ultimate-base-0.3.0 app/assets/javascripts/ultimate/backbone/model.js.coffee
ultimate-base-0.3.0.alpha app/assets/javascripts/ultimate/backbone/model.js.coffee