Commit 648cb28
Allow unwritable PK when associating on create
Imagine updating a `Position`, changing the `Employee` it is associated
with. Since we're justassociating, we don't need `Employee`s PK to be
writable. But because our internals end up saving the `Employee`
regardless - we just walk the tree, and `id` is part of the attributes
considered - so we'd normally validate the PK, even though we really
don't need to.
We already avoided validating the PK when *updating* the `Position`,
this PR also considers *creating* the `Position` and associating to a
pre-existing `Employee`. We do this by looking at the `method` of
each sidepost, instad of the overall action being called.1 parent 19c75b5 commit 648cb28
File tree
2 files changed
+72
-19
lines changed- lib/graphiti/request_validators
- spec/integration/rails
2 files changed
+72
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | | - | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | | - | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
408 | | - | |
409 | 407 | | |
410 | 408 | | |
411 | 409 | | |
| |||
414 | 412 | | |
415 | 413 | | |
416 | 414 | | |
417 | | - | |
418 | | - | |
| 415 | + | |
| 416 | + | |
419 | 417 | | |
420 | 418 | | |
421 | 419 | | |
422 | 420 | | |
423 | 421 | | |
424 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
439 | 447 | | |
440 | 448 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
445 | 472 | | |
446 | 473 | | |
447 | 474 | | |
| |||
465 | 492 | | |
466 | 493 | | |
467 | 494 | | |
468 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
469 | 498 | | |
470 | 499 | | |
471 | 500 | | |
| |||
491 | 520 | | |
492 | 521 | | |
493 | 522 | | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
498 | 546 | | |
499 | 547 | | |
500 | 548 | | |
| |||
0 commit comments