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
class Bmc < ActiveRecord::Base
has_many :segments
has_many :value_propositions
has_many :relationships
amoeba do
enable
end
end
class Segment < ActiveRecord::Base
has_one :value_proposition
has_and_belongs_to_many :relationships
amoeba do
recognize [:has_one, :has_and_belongs_to_many]
end
end
class ValueProposition < ActiveRecord::Base
belongs_to :bmc
belongs_to :segment
amoeba do
recognize :belongs_to
end
end
class Relationship < ActiveRecord::Base
belongs_to :bmc
has_and_belongs_to_many :segments
amoeba do
recognize :has_and_belongs_to_many
end
end
In my controller I'm doing
bmc_copy = Bmc.find(id).amoeba_dup
bmc_copy.save.
I wanted to duplicate the records recursively when I dup the bmc. But for some reason segment_id(s) not getting updated properly in relationship and value_proposition tables, when i save the bmc_copy(original segment id(s) is getting copied as-is and not the duplicated sendment's id).
Can someone help me where am I doing wrong?
The text was updated successfully, but these errors were encountered:
Hi All,
I have the following models
In my controller I'm doing
I wanted to duplicate the records recursively when I dup the bmc. But for some reason
segment_id(s)
not getting updated properly inrelationship
andvalue_proposition
tables, when i save the bmc_copy(original segment id(s) is getting copied as-is and not the duplicated sendment's id).Can someone help me where am I doing wrong?
The text was updated successfully, but these errors were encountered: