I was dev a RoR application and before I drop accidentally 4 of my tables which 2 has FKs to the another 2 so when I restore it and make the tables "stable" I try to insert a record that contain fk from pacientes, hclinicos and dientes
OCIError: ORA-02291: integrity constraint (FELIPE.ODONTODIAGRAMAS_DIENTE_ID_FK) violated -
parent key not found:
INSERT INTO "ODONTODIAGRAMAS" ("DIENTE_ID", "SIMBOLOGIA_ID", "HCLINICO_ID", "CREATED_AT", "UPDATED_AT", "ID")
VALUES (:a1, :a2, :a3, :a4, :a5, :a6)
FELIPE is the database, ODONTODIAGRAMAS is the table, which I am inserting and DIENTE is another table that contains multiple records and I render them in hclinico_new view to save them in another table
This is how I render the DIENTES to save them
<%= f.fields_for :odontodiagramas do |odontodiagramas_for_form| %>
<%= odontodiagramas_for_form.collection_select :simbologia_id, Simbologia.all, :id, :simbolo, { prompt: "Estado" }, { class: "form-control" } %>
<%= odontodiagramas_for_form.hidden_field :diente_id, :value => Diente.find(1) %>
<%= odontodiagramas_for_form.hidden_field :_destroy %>
of course they are more than 1.maybe its an error in the db composition? The weird is that this is not the only table that insert a constraint in another table so I don't understand why I'm getting this error