# 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
{ | |
"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 { 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
`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 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'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
function remove_fields(link) {
$(link).prev("input[type=hidden]").val("1");
$(link).closest(".fields").hide();
}
function add_fields(link, association, content) {
var new_id = new Date().getTime();
var regexp = new RegExp("new_" + association, "g")
$(link).parent().before(content.replace(regexp, new_id));
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
utf8:✓ | |
_method:put | |
authenticity_token:hDl1Fox1KyXq1ev3RvhT7euijxj3CJSxGP9jxkgCMmQ= | |
survey[name]:What's your favorite Pizza? | |
survey[questions_attributes][0][content]:What's your favorite kind of cheese? | |
survey[questions_attributes][0][_destroy]:0 | |
survey[questions_attributes][0][answers_attributes][0][content]:mozzarella | |
survey[questions_attributes][0][answers_attributes][0][_destroy]:false | |
survey[questions_attributes][0][answers_attributes][0][id]:10 | |
survey[questions_attributes][0][id]:4 |
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
<fieldset> | |
<label for="survey_questions_attributes_0_answers_attributes_0_content">Answer</label> | |
<input id="survey_questions_attributes_0_answers_attributes_0_content" name="survey[questions_attributes][0][answers_attributes][0][content]" size="30" type="text" value="mozzarella"> | |
<input id="survey_questions_attributes_0_answers_attributes_0__destroy" name="survey[questions_attributes][0][answers_attributes][0][_destroy]" type="hidden" value="false"> | |
<a href="#" class="remove_fields">remove</a> | |
</fieldset> |