When creating a new event I have an option that is enabled with a checkbox that is to duplicate a quote already made of another event already created, I display the list of which event I need to duplicate that quote, I have several tables where it is saved one of them is one called sections and I need to duplicate the rows that have that id which is identified by quotation_id to know what event it belongs to, what I have to do is make a query to that table read the rows that have that id that I need to duplicate, duplicate those rows (create new records in my row), but when duplicating them I need to change the quotation_id to the new event I'm creating.
I do not know if you explain me well. Any suggestions on how I could do it?
def duplicate_data
if params[:showhide] == "1"
event_selected = params[:event_id_select] #quotation_id
event_current = Event.last.id #Id del nuevo evento que se esta creando
end
end