1

So I have an array of user uuids and I want to update one field that all of those users have(I am guaranteed that they have a value for that field).

I know that I should be using update_all to update all of the fields in one transaction. However, I'm not sure how to select users given an array of user uuids that can then be supplied to the update_all.

What can I do?

1 Answer 1

3

User.where(uuid: [uuid_array]) will return an ActiveRecord Relation, on which you can call update_all.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.