If I have record A which has been saved in the database, then I want to replace it with a newly created record B which has not been saved. So B can then be saved in the database but with the id of from A (and A is replaced). Is this possible in Rails Active Record?
P.S. the reason behind this is that I need to merge objects by some condition, and constructing an object requires some internet fetching/parsing. So if time is used to parse B I want to prevent parsing it again for A, but replacing it with B.
You can do something like this: