# Usage:
#
# post.serialize(include: ['comments'], comments: {include: ['author']})
#
# gives:
# {
# data: {
# attributes: {id: 1, name: 'post name'},
# relationships: {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.FixtureAdapter.extend({ | |
host: 'https://api.example.com' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`import Ember from 'ember'` | |
class JSONAPISerialization | |
constructor: (@records) -> | |
@includes = [] | |
toJSON: (opts = {}) => | |
json = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`import { moduleFor, test } from 'ember-qunit'` | |
moduleFor 'serializer:application', 'Unit | Serializer | application', | |
needs: [] | |
beforeEach: -> | |
@TestModel = DS.Model.extend | |
name: DS.attr('string') | |
updatedAt: DS.attr('date') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"revision_id": "6da245a4621d586129009810ab6c4a867981115875cc64a6453579ca62ececb1", | |
"name": "example PF from code", | |
"run_list": [ | |
"recipe[blp-base::default]" | |
], | |
"cookbook_locks": { | |
"blp-base": { | |
"version": "1.5.1", | |
"identifier": "1a10ad058a6beff07636e07c0cfe8e73552ef540", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
1/0 | |
rescue => e | |
event = Raven.capture_exception(e) | |
sentry_link = "http://sentry.ny.cas.inf.bloomberg.com/sentry/chef-client/?query=#{event.id}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic AR | |
class PeopleController < ApplicationController | |
jsonapi do | |
allow_filter :name, aliases: [:full_name] # ?filter[full_name] == ?filter[name] | |
allow_filter :title, if: :admin? # calls #admin? on the controller | |
includes whitelist: [:company, { pets: :breeds}] | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fieldList = [ | |
{ label: 'Foo Fields', fields: [{name: 'foo', selected: false}] }, | |
{ label: 'Bar Fields', fields: [{name: 'bar', selected: true}] } | |
] | |
fields: Ember.computed('fieldList.@each', function() { | |
let fields = [] | |
this.get('fieldList').forEach((config) => { | |
config.get('fields').forEach((field) => { | |
fields.push(field); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import DS from 'ember-data'; | |
import moduleForAcceptance from '../../../tests/helpers/module-for-acceptance'; | |
import NestedRelationsMixin from 'ember-data-extensions/mixins/nested-relations'; | |
import ModelMixin from 'ember-data-extensions/mixins/model'; | |
QUnit.dump.maxDepth = 999999999; | |
let serializer = null; | |
let store = null; |