2

Railsオブジェクトを複製してcreated_atいます。オブジェクトの値を除くすべての詳細で正常に複製されています。深い複製を行うために deep_clone gem を使用しています。

ここにコードがあります。raw_materials と costing_items の created_at 値が必要です。

@costing = @old_costing.deep_clone :include => [{style: :images}, {raw_materials: :costing_items} , :other_cost_fixeds, :other_costs, :exchange_rates ], :use_dictionary => true do |original, kopy|
                kopy.remote_picture_url = original.picture_url if kopy.is_a?(Image)
            end
4

1 に答える 1