How to make embedded hasMany relationships work with ember data

On master, the correct API is: App.Adapter.map(‘App.Post’, { comments: { embedded: ‘always’ } }); The two possible values of embedded are: load: The child records are embedded when loading, but should be saved as standalone records. In order for this to work, the child records must have an ID. always: The child records are embedded … Read more

How do you create a custom adapter for ember.js?

For Ember Data This is up to date as of Ember Data 1.0 beta 9. Extend one of the Ember Data Adapters. To make it site wide: App.ApplicationAdapter = DS.RESTAdapter.extend(…. To make it model specific: App.FooAdapter = DS.RESTAdapter.extend(… Then you will define the implementation you’d like to override. You always have the option to call … Read more

Ember-data embedded records current state?

Using the ActiveModelSerializer you can include the EmbeddedRecordsMixin which allows you to use embedded records. (In the canary versions, 1.0 beta 9+, you can use the JsonSerializer/RESTSerializer as well) Serializer App.ColorSerializer = DS.ActiveModelSerializer.extend(DS.EmbeddedRecordsMixin, { attrs: { foos: {embedded: ‘always’} } }); Models App.Color = DS.Model.extend({ color: DS.attr(), foos: DS.hasMany(‘foo’) }); App.Foo = DS.Model.extend({ name: DS.attr() … Read more

CRUD blueprint overriding in sails.js

Update In order to override blueprints in Sails 1.0 in the manner described below, you must first install the “custom blueprints” plugin for your project (npm install sails-hook-custom-blueprints). To override blueprints in Sails v0.10, you create an api/blueprints folder and add your blueprint files (e.g. find.js, create.js, etc.) within. You can take a look at … Read more

SPA best practices for authentication and session management

This question has been addressed, in a slightly different form, at length, here: RESTful Authentication But this addresses it from the server-side. Let’s look at this from the client-side. Before we do that, though, there’s an important prelude: Javascript Crypto is Hopeless Matasano’s article on this is famous, but the lessons contained therein are pretty … Read more

tech