Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

has_many relations deleted on save

edited October 2015 in Bug Reports
Hi,

I have a strange behaviour. I have a missions_model with a has_many relationship to mission_images_model. mission_images_model has the vice-versa belongs_to relationship to missions_model.

In my backend the assignment of mission_images to mission is done via the mission_images_model. IN the missions_Model I changed the type of mission_images to hidden.

Now I create a mission and then assigne some images via mission_images. Everything works fine, the relations are stored in relationship table.

Now I edit the mission and save it. Then unfortunatly and strangely the relations in the relationship table are deleted.
Do you have any idea why this is happening?

If I do not change the type of mission_images to hidden everything works fine. Is there another possibility not to show the has_Many relationship in the missions_model?

KR
Habib

Comments

  • edited 12:38AM
    Try adding the following property to your model first to see if this prevents the issue:
    protected $clear_related_on_save = FALSE;
  • edited 12:38AM
    did it. Thanks!
Sign In or Register to comment.