Is it possible to get the number of affected rows, after updating data?
Here a example:
count = table_products.where(:status => 1).update(:status => 0) # is sth like this possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Have you tried it? Docs say that
updateactually returns the number of affected rows:I don’t have MySQL to check whether it actually works, but if it doesn’t, I guess it’s up to MySQL, not Sequel.