Error: Cannot Call Create Unless The Parent Is Saved In Rails

Posted by Weston Ganger on March 11, 2016

I was having a weird issue in an app where it was spitting an error at me when trying to delete a record: Cannot call create unless the parent is saved

In my case this issue was caused by audited-activerecord and paranoia gems. I found an issue for this and the paranoia author has said this will not be fixed.

So the answer here is just switch the gem acts_as_paranoid instead of paranoia. This should require no code changes.

Also note that I wouldnt recommend using audited-activerecord anymore it has some shortcomings. You should use paper_trail instead because it provides so much more flexibility to you auditing solution and is infinitely better.

Related External Links:

Posted in Rails and Tagged with rails active-record auditing 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts