You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue bellow is probably related to the commit which adds validations in combination with "inverse_of". The problem is that when importing an image (with some invalid fields, e.g. base image's name), validations are done mutliple times. You can reproduce with following code:
irb(main):004:0> x = Tim::BaseImage.new("pool_family_id"=>"1", "import"=>"true", "image_versions_attributes"=>{"0"=>{"target_images_attributes"=>{"0"=>{"provider_images_attributes"=>{"0"=>{"provider_account_id"=>"2", "external_image_id"=>""}}}}}}, "name"=>"")
irb(main):005:0> x.valid?
=> false
irb(main):007:0> x.errors.full_messages
=> ["Name can't be blank", "Name can't be blank", "Image versions base image name can't be blank", "Image versions target images image version base image name can't be blank", "Image versions target images target can't be blank", "Image versions target images provider images target image image version base image name can't be blank", "Image versions target images provider images target image target can't be blank", "Image versions target images provider images external image can't be blank"]
The text was updated successfully, but these errors were encountered:
This issue is indeed caused by the inverse_of vs accepts_nested_attributes bug that currently have a patch for. Unfortunatley the patch does not cover duplicate validations which is what we are seeing here.
For the time being Jan has agreed to fix this in conductor. I am hoping this will be fixed soon in Rails. This is another case for not using accpets_nested_attributes_for in models. I am starting to think that creating our own gem for generating nested objects from hash maps is the way forward.
The issue bellow is probably related to the commit which adds validations in combination with "inverse_of". The problem is that when importing an image (with some invalid fields, e.g. base image's name), validations are done mutliple times. You can reproduce with following code:
irb(main):004:0> x = Tim::BaseImage.new("pool_family_id"=>"1", "import"=>"true", "image_versions_attributes"=>{"0"=>{"target_images_attributes"=>{"0"=>{"provider_images_attributes"=>{"0"=>{"provider_account_id"=>"2", "external_image_id"=>""}}}}}}, "name"=>"")
irb(main):005:0> x.valid?
=> false
irb(main):007:0> x.errors.full_messages
=> ["Name can't be blank", "Name can't be blank", "Image versions base image name can't be blank", "Image versions target images image version base image name can't be blank", "Image versions target images target can't be blank", "Image versions target images provider images target image image version base image name can't be blank", "Image versions target images provider images target image target can't be blank", "Image versions target images provider images external image can't be blank"]
The text was updated successfully, but these errors were encountered: