File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -376,7 +376,7 @@ BaseModel.prototype.toJsonApi = function () {
376376 } ;
377377
378378 for ( const [ attribute , options ] of Object . entries ( this . schema . attributes ) ) {
379- if ( ! this . isModified ( attribute ) ) continue ;
379+ if ( ! this . isNew && ! this . isModified ( attribute ) ) continue ;
380380
381381 let value = this . get ( attribute ) ;
382382 if ( options ?. transform ) {
@@ -391,7 +391,7 @@ BaseModel.prototype.toJsonApi = function () {
391391 }
392392
393393 for ( const [ relationship , options ] of Object . entries ( this . schema . relationships ) ) {
394- if ( ! this . isModified ( relationship ) ) continue ;
394+ if ( ! this . isNew && ! this . isModified ( relationship ) ) continue ;
395395
396396 const value = this . get ( relationship ) as ModelInstance < Record < string , any > > | ModelInstance < Record < string , any > > [ ] | null ;
397397
You can’t perform that action at this time.
0 commit comments