⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Beware with set_relation_n_n



Amit Shah
  • profile picture
  • Member

Posted 02 October 2014 - 19:29 PM

Hello team GC.

 

I was in an encounter with a haunted situation / scenario where i have had conditional fields and stuff... where 1 field was supposed to be an in relation with n_n with another table.

 

Now what i ended up with was .. writing a conditional where i didnt set that field in for edit (that was not required for the situation) but i unexpectedly added set_relation_n_n with that field (the one that didnt exist in the field list)

 

Now what used to happen - when i saved a record, it ended up deleting the entries from the n_n relation table. And it was super haunting as i never ever have had written a code to delete it...

 

It took up quite a number of hours of mine to determine that this was a delete that was being caused up by adding an unnecessary set_relation_n_n to a field that was not in configuration...

 

I lost up a lot of hours for that.. but you can be aware by this scenario and save your hours and data.

 

I hope Web Johny will come up with a solution some day ... I will try to provide if possible as for now i am not in a position .. due to my time...

 

Happy GCing to all of you my fellow coders.