e5f5440663
Deep-cloned objects have all their relationships stale. Thus, for a newly deep-cloned revision, `revision.types_de_champs` returns `[]`, even when it actually has associated types de champ. This causes consecutive champs creations and re-ordering to fail in subtle ways, like: ``` procedure.draft_revision.add_type_de_champ(…) procedure.publish_revision! procedure.draft_revision.add_type_de_champ(…) procedure.draft_revision.move_type_de_champ(…) # this will fail ``` As `publish_revision!` created a new stale revision, moving the type de champ fails because not all existing champs are found until the object is refreshed. We don't hit this path in production, because usually only a single operation is made in a request. To fix this, save the new revision before associating it as the draft procedure. (Another option would be to `reload` the revision after creation, but this seems better contained and matches the name of the method.) |
||
---|---|---|
.. | ||
controllers | ||
factories | ||
fixtures | ||
helpers | ||
jobs | ||
lib | ||
mailers | ||
middlewares | ||
models | ||
policies | ||
serializers | ||
services | ||
support | ||
system | ||
views | ||
rails_helper.rb | ||
spec_helper.rb |