Sha256: 8fed743e20b9fd8dce34d8402e75469fe19b0722fe00c4bbc27c926fc8712c91

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

class Faalis.HasManyField extends Faalis.BaseField
  type: 'has_many'
  relation: true

  # **Name**:   The name of current field.
  # **object**: Target resource object
  constructor: (name, resource) ->
    @name = name
    @resource = resource
    console.log(resource)

  __init__: ->
    console.log("<<<<<<<<<<<<<<<<")
    console.log(this)
    #console.log(@resource)
    return
    @resource = new @resource()

    unless @resource.__init__?
      throw "'" + @to + "' does not have '__init__' method."

    Faalis.$injector.invoke(@resource.__init__, @resource)


  # Fetch all the possible objects for current relation.
  # for example if @object was Post resource, then it will
  # fetch all the post from API
  fetch_all_objects: ->
    # --- This method should run after injection ---
    return @object.all()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faalis-1.0.0.alpha4 app/assets/javascripts/faalis/dashboard/lib/fields/has_many_field.js.coffee