Skip to content

How do use mixins in models #103

@rauhryan

Description

@rauhryan

If I define a mixin and try and use it in a model the mixin is undefined on the App object when the model is defined.

var Serializable = Ember.Mixin.create({
  serialize: function () {
    var result = {};
    for (var key in $.extend(true, {}, this))
    {
        // Skip these
        if (key === 'isInstance' ||
        key === 'isDestroyed' ||
        key === 'isDestroying' ||
        key === 'concatenatedProperties' ||
        typeof this[key] === 'function')
        {
            continue;
        }
        result[key] = this[key];
    }
    return result;
  }
});

module.exports = Serializable;
var Model = Ember.Object.extend(App.Serializable, {});

App. Serializable is undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions