Skip to content

Commit

Permalink
Fix global require
Browse files Browse the repository at this point in the history
The global require in this file was causing an error when using babel 6 with the transform-es2015-modules-amd plugin

fixes #4134
  • Loading branch information
jmurphyau committed Feb 12, 2016
1 parent 11627a9 commit 617f5a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/-private/system/relationships/has-many.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@module ember-data
*/


import Ember from 'ember';
import { assert } from "ember-data/-private/debug";
import normalizeModelName from "ember-data/-private/system/normalize-model-name";
Expand Down Expand Up @@ -145,10 +146,9 @@ export default function hasMany(type, options) {
return relationship.getRecords();
},
set(key, records) {
var Model = require('ember-data/model').default;
assert("You must pass an array of records to set a hasMany relationship", isArrayLike(records));
assert(`All elements of a hasMany relationship must be instances of DS.Model, you passed ${Ember.inspect(records)}`, (function() {
return Ember.A(records).every((record) => Model.detectInstance(record) );
return Ember.A(records).every((record) => record.hasOwnProperty('_internalModel') === true);
})());

var relationship = this._internalModel._relationships.get(key);
Expand Down

0 comments on commit 617f5a6

Please sign in to comment.