moiristo / deep_cloneable

This gem gives every ActiveRecord::Base object the possibility to do a deep clone that includes user specified associations.
MIT License
785 stars 89 forks source link

rails 4 deep_clone different in development/staging and production #120

Closed StephanSinn closed 4 years ago

StephanSinn commented 4 years ago

Dear Moiristo,

Here is my stack overflow post which describes the problem in detail. I hope you can help me here:

https://stackoverflow.com/questions/62576235/rails-4-deep-clone-different-in-development-staging-and-production

PS: I today updated to v3 of the gem. No changes.

Thanks and best regards, Stephan

moiristo commented 4 years ago

Hello,

I don't think this is related to the gem actually. Looking at your logs, my hunch is that you are rendering something on the redirect page that calls GET interactions#duplicate with the old ID again. I've seen stuff like this happen in the past caused an img attribute with the URL as its src :) To verify that something like this is happening, I'd suggest you don't perform mutations in GET requests. Always use POST instead. Then, check your browser console to see what is being sent to the server.

Hope this helps..

StephanSinn commented 4 years ago

Hi Moiristo,

thanks a lot! It worked out for me. I rewrote the action to be POST not GET and so now only on copy is generated!

This issue can be closed!

Thanks a lot! Cheers, Stephan