DEV Community

Discussion on: Why is Rails ActiveRelation.update_all updating a different set of records?

Collapse
 
andy profile image
Andy Zhao (he/him) • Edited

Hmm interesting, I'll give this a try when I get a chance.

Re: what I'm trying to do. I'm trying to combine two Active record queries and then do a third where query to get only the commenter's comments. The final chained query should produce a single SQL query, and then I want to update_all a single collection/relation of records.

The where is called on the ActiveRecord relation and not an individual ActiveRecord record, which is how I can chain the where after doing union.