Retrieving the IDs for a Model
ids method to
map(&:id) when you want to retrieve an array of model IDs.
In the example above, using
ids avoids fetching the receive orders from the database.
def ids pluck primary_key end
Written on August 25, 2016 by alistairmckinnell