# Class Method or Factory method in ember data models

**URL:** <https://discuss.emberjs.com/t/class-method-or-factory-method-in-ember-data-models/6465>\
**Category:** Ember Data\
**Created:** [October 9, 2014, 11:05pm UTC](https://discuss.emberjs.com/t/class-method-or-factory-method-in-ember-data-models/6465 "2014-10-09T23:05:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eccegordo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/eccegordo/32/14927_2.png) [@eccegordo](https://discuss.emberjs.com/u/eccegordo)\
**Post date:** [October 9, 2014, 11:05pm UTC](https://discuss.emberjs.com/t/class-method-or-factory-method-in-ember-data-models/6465/1 "2014-10-09T23:05:03Z")

</div>

Just wondering if there is a convention or specific precedent for the following code pattern.

I want to define a model and declare a “Class method” or rather custom initializer or factory type method to it that changes how I can instantiate new instances of it.

Imagine the following Person model

```
import DS from 'ember-data';
var attr = DS.attr;
export default DS.Model.extend({
  first: attr('string'),
  last: attr('string'),
  dob: attr(),

 customCreate: function(f, n, d){
  this.createRecord({}); 
  this.set('first', f);
  this.set('last', l);
  this.set('dob', d);
 }
});

```

And then downstream I can create an instance like so:

```
p = Person.customCreate('John', "Smith', '1/1/1970');

```
