Skip to content

Instantly share code, notes, and snippets.

@doxavore
Created February 7, 2012 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doxavore/1761475 to your computer and use it in GitHub Desktop.
Save doxavore/1761475 to your computer and use it in GitHub Desktop.
Don't let Ember.js override setter
Person = Ember.Object.extend({
pets: (function (key, val) {
if (arguments.length > 1) {
// set value
}
else {
// return value
}
}).property('_pets')
});
Person.reopenClass({
create: function (opts) {
var obj, pets;
if (opts && opts.pets) {
pets = opts.pets;
delete opts.pets;
}
obj = this._super.apply(this, arguments);
if (pets) {
obj.set('pets', pets);
}
return obj;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment