Sha256: 5f05bdcda3363fb4bbc8e02ee30b315bd7e716b77ebc050e930b433e81eb659e

Contents?: true

Size: 698 Bytes

Versions: 3

Compression:

Stored size: 698 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: ->
    modelName = @constructor.modelName or @modelName or @className or @constructor.name or 'Model'
    _.singularize(_.string.underscored(modelName))

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ultimate-base-0.3.3.0 app/assets/javascripts/ultimate/backbone/model.js.coffee
ultimate-base-0.3.2.1 app/assets/javascripts/ultimate/backbone/model.js.coffee
ultimate-base-0.3.2 app/assets/javascripts/ultimate/backbone/model.js.coffee