# Create empty model from controller property

**URL:** https://discuss.emberjs.com/t/create-empty-model-from-controller-property/6052
**Category:** Uncategorized
**Created:** [August 10, 2014, 6:35pm UTC](https://discuss.emberjs.com/t/create-empty-model-from-controller-property/6052 "2014-08-10T18:35:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Linuus](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/linuus/32/9391_2.png) [@Linuus](https://discuss.emberjs.com/u/Linuus)
#### Post date: [August 10, 2014, 6:35pm UTC](https://discuss.emberjs.com/t/create-empty-model-from-controller-property/6052/1 "2014-08-10T18:35:57Z")

</div>

Hi

I’m trying to go through the pluralsight tutorial about Ember.js fundamentals but using ember-cli (I uninstalled ember-data). My app is called GithubExplorer and I have one problem.

I have a simple model in app/models/issue.js

```
import Ember from 'ember';
export default Ember.Object.extend({
  title: "",
  body: ""
});

```

Then I have a controller in app/controllers/repository/newissue.js which tries to create an issue object, like this:

```
import Ember from 'ember';

export default Ember.Controller.extend({
  needs: ['repository'],
  repo: Ember.computed.alias('controllers.repository'),
  issue: function() {
    return GithubExplorer.Issue.create(); // This gives error
  }.property('repo.model'),
  actions: {
    submitIssue: function() {
      var issue = this.get('issue');
      // Do stuff...
    }
  }
});

```

When this is run `GithubExplorer.Issue.create()` I get the error `Uncaught TypeError: Cannot read property 'create' of undefined`. So, GithubExplorer.Issue is undefined. How do I access the “model” and create it from the issue function?

---

<div class="post-metadata">

### Author: ![Linuus](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/linuus/32/9391_2.png) [@Linuus](https://discuss.emberjs.com/u/Linuus)
#### Post date: [August 10, 2014, 7:30pm UTC](https://discuss.emberjs.com/t/create-empty-model-from-controller-property/6052/2 "2014-08-10T19:30:12Z")

</div>

Ah, Ok so I had to import it first in `app/controllers/repository/newissue.js` like this:

```
import Issue from '../../models/issue';

```

Then use it directly: `Issue.create();`

---

<div class="post-metadata">

### Author: ![HeroicEric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/heroiceric/32/18432_2.png) [@HeroicEric](https://discuss.emberjs.com/u/HeroicEric)
#### Post date: [August 11, 2014, 4:11am UTC](https://discuss.emberjs.com/t/create-empty-model-from-controller-property/6052/3 "2014-08-11T04:11:40Z")

</div>

You could also have used `this.store.createRecord('issue');` without having to import the Issue model.

---

<div class="post-metadata">

### Author: ![Linuus](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/linuus/32/9391_2.png) [@Linuus](https://discuss.emberjs.com/u/Linuus)
#### Post date: [August 11, 2014, 1:24pm UTC](https://discuss.emberjs.com/t/create-empty-model-from-controller-property/6052/4 "2014-08-11T13:24:40Z")

</div>

Ok, I thought I tried that but that it did not work if I didn’t use ember-data. I will test it again 🙂 Thanks.

---

<div class="post-metadata">

### Author: ![HeroicEric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/heroiceric/32/18432_2.png) [@HeroicEric](https://discuss.emberjs.com/u/HeroicEric)
#### Post date: [August 11, 2014, 3:59pm UTC](https://discuss.emberjs.com/t/create-empty-model-from-controller-property/6052/5 "2014-08-11T15:59:51Z")

</div>

Nope, you’re right. That won’t work if you’re not also using Ember Data. Sorry, I should not have assumed that you were.
