Sha256: 4dfd836815117d2bfce3b008ee03ae0a9abef5ee799a416f989d312a6ab20fd5
Contents?: true
Size: 646 Bytes
Versions: 3
Compression:
Stored size: 646 Bytes
Contents
module Amoeba module Macros class HasAndBelongsToMany < ::Amoeba::Macros::Base def follow(relation_name, _association) clone = @cloner.amoeba.clones.include?(relation_name.to_sym) @old_object.__send__(relation_name).each do |old_obj| fill_relation(relation_name, old_obj, clone) end end def fill_relation(relation_name, old_obj, clone) # associate this new child to the new parent object old_obj = old_obj.amoeba_dup if clone relation_name = remapped_relation_name(relation_name) @new_object.__send__(relation_name) << old_obj end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
amoeba-3.2.0 | lib/amoeba/macros/has_and_belongs_to_many.rb |
amoeba-3.1.0 | lib/amoeba/macros/has_and_belongs_to_many.rb |
amoeba-3.0.0 | lib/amoeba/macros/has_and_belongs_to_many.rb |