This repository was archived by the owner on Aug 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 33 */
44var util = require ( 'util' ) ;
55var actionUtil = require ( './_util/actionUtil' ) ;
6- var find = require ( 'lodash/Collection /find' ) ;
6+ var find = require ( 'lodash/collection /find' ) ;
77
88/**
99 * Populate (or "expand") an association
Original file line number Diff line number Diff line change 44
55var actionUtil = require ( './_util/actionUtil' ) ;
66var util = require ( 'util' ) ;
7- var cloneDeep = require ( 'lodash/Lang /cloneDeep' ) ;
7+ var cloneDeep = require ( 'lodash/lang /cloneDeep' ) ;
88
99/**
1010 * Enable sideloading. Edit config/blueprints.js and add:
Original file line number Diff line number Diff line change 44 * @module Ember
55 */
66
7- var _ = require ( 'lodash' ) ,
8- pluralize = require ( 'pluralize' ) ;
7+ var forEach = require ( 'lodash/collection/forEach' ) ;
8+ var map = require ( 'lodash/collection/map' ) ;
9+ var size = require ( 'lodash/collection/size' ) ;
10+ var pluralize = require ( 'pluralize' ) ;
911
1012module . exports = {
1113 linkAssociations : function ( model , records ) {
1214 if ( ! Array . isArray ( records ) ) records = [ records ] ;
1315 var modelPlural = pluralize ( model . identity ) ;
1416
15- return _ . map ( records , function ( record ) {
17+ return map ( records , function ( record ) {
1618 var links = { } ;
17- _ . each ( model . associations , function ( assoc ) {
19+ forEach ( model . associations , function ( assoc ) {
1820 if ( assoc . type == "collection" ) {
1921 links [ assoc . alias ] = sails . config . blueprints . prefix + "/" + modelPlural + "/" + record . id + "/" + assoc . alias ;
2022 }
2123 } ) ;
22- if ( _ . size ( links ) > 0 ) {
24+ if ( size ( links ) > 0 ) {
2325 record . links = links ;
2426 }
2527 return record ;
You can’t perform that action at this time.
0 commit comments