Rails 4 ActiveRecord .where any element in one array is in another array
问题 I have a list of ids that looks something like this: feed_ids = [1,2,3,4,5] # will be filled with random ids I have a Post model that has an attribute parent_ids that might look something like this: parent_ids = [20,14,1] I want to retrieve all records where an element in parent_ids matches an element in feed_ids I tried this but it's not working: nodes = Post.where(parent_ids: feed_ids) It's not giving me an error but it's also not returning any records. 回答1: The find method can take in an