Answer the question
In order to leave comments, you need to log in
RoR. ON DUPLICATE KEY UPDATE `amount` = `amount`+1. Already blown my mind. How?
I’ll clarify right away that the option ActiveRecord::Base.connection.insert(......)
is already at the worst possible end. Model.(create/find)_or_initialize_by(...)
- absolutely not.
The search for answers began with the activerecord-import jam , because mass inserts are just planned. It has on-duplicate-key-update , but I didn’t figure out how to use it (How to change one value to another is understandable, but how to do `int_column` = `int_column`+1, this remains a mystery to me.
Help figure out who might come across it.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question