Where to define non-persistable Ember Objects?

Hi!

I want to create a plain old object to encapsulate a bunch of other objects and operations on those objects.

I’m wondering where I should be storing a class definitions for such an object in my project directory?

e.g. Where should I write this

App.Person = Ember.Object.extend({
  helloWorld: function() {
    alert("Hi, my name is " + this.get('name'));
  }
});

such that in my Controller I can say

var tom = App.Person.create({
  name: "Tom Dale"
});

Is it a helper and thus should go in the helper folder? I don’t feel like it is a model since my model folder contains exclusively Ember Data model and App.Person is not something I want persisted.

Thanks!

I’m not sure what your end goal is, but the helpers folder is for templates. You could probably put it in the utils or lib folder, export it as an ES6 module and then import it where you need it.

1 Like