You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a sub-issue or related to #75. If you have a clone declaration but set neither include or exclude on a model, amoeba is set to indiscriminate/copy everything mode, as both amoeba.includes and amoeba.excludes is empty.
A fix which I'm using ensures the cloned column is also present in the includes in this case. Seems to work for my use case:
defapply_clonesamoeba.clones.eachdo |clone_field|
ensure_clone_in_includes(clone_field)exclude_clone_if_has_many_through(clone_field)endend# If the field to be cloned isn't in the includes, add it so it # can be processed in the apply_associations step.# This handles the case where no includes or excludes are set.defensure_clone_in_includes(clone_field)returnifamoeba.excludes.present?amoeba.includes[clone_field]={}unlessamoeba.includes.values.include?(clone_field)end
Happy to place a PR with this change if someone wouldn't mind reviewing it.
The text was updated successfully, but these errors were encountered:
benjamin-hull
changed the title
Setting only clone puts amoeba in an indiscriminate mode
Setting only clone puts amoeba in indiscriminate mode
Jan 22, 2019
benjamin-hull
changed the title
Setting only clone puts amoeba in indiscriminate mode
Setting only clone puts amoeba in indiscriminate mode
Jan 22, 2019
This is a sub-issue or related to #75. If you have a
clone
declaration but set neitherinclude
orexclude
on a model, amoeba is set to indiscriminate/copy everything mode, as bothamoeba.includes
andamoeba.excludes
is empty.A fix which I'm using ensures the cloned column is also present in the
includes
in this case. Seems to work for my use case:Happy to place a PR with this change if someone wouldn't mind reviewing it.
The text was updated successfully, but these errors were encountered: