INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE a='4', b='5', c='6'
how to implement this type(insert and update) of sql in rails in single statement if possible
INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE a='4', b='5', c='6'
how to implement this type(insert and update) of sql in rails in single statement if possible
You can run your sql directly:
sql = "INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE a='4', b='5', c='6'"
ActiveRecord::Base.connection.insert_sql sql