Skip to content

Instantly share code, notes, and snippets.

@Mariusio
Created February 10, 2016 16:13
Show Gist options
  • Save Mariusio/3702858fb2db2d0d0d7f to your computer and use it in GitHub Desktop.
Save Mariusio/3702858fb2db2d0d0d7f to your computer and use it in GitHub Desktop.
import Ember from 'ember';
import DS from 'ember-data';
import {
validator, buildValidations
}
from 'ember-cp-validations';
const Validations = buildValidations({
name: validator('presence', true)
});
export default DS.Model.extend(Validations, {
visualizations: DS.hasMany('visualization', {polymorphic: true}),
selectedVisualization: Ember.computed('visualizations', function() {
return this.get('visualizations').filterBy('recommendation', false).filterBy('active', true).get('firstObject');
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment