NameL3ss

mismatch nested attributes

Jan 18th, 2025
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. def remove_records!
  2. remove_ids = @document_attribute_params["document_attribute_options_attributes"].select{|x| x["_destroy"] == true }.map{|x| x["id"].to_i }
  3. return unless remove_ids.present?
  4.  
  5. DocumentAttributeOption.where(id: remove_ids).destroy_all
  6. @document_attribute_params["document_attribute_options_attributes"].reject!{|x| x["_destroy"]}
  7. end
  8. fix remove and create mismatch
  9.  
  10.  
Advertisement
Add Comment
Please, Sign In to add comment