I have an array of identifiers that I want to find their corresponding records from the database using the active record query. for example: ids = [2, 3, 1]
Now, for me, to find all the records of a particular model, whose identifier is one of the elements in the array. In lower versions of rails, I think I can do something like:
Model.find_all_by_id([2, 3, 1])
but according to this post ,
These methods were deprecated on 4.0 and removed at 4.1. If you want to keep sing then you need to include this gem https://github.com/rails/activerecord-deprecated_finders
My question is that I cannot do this in rails4.2 without having to include a gem?
Thanks.
ruby-on-rails activerecord ruby-on-rails-4
dat_sunday
source share