Module: DbMemoize::Helpers
Overview
The Helpers module contains some helper methods, mostly to not pollute the namespace of memoized objects and classes.
Instance Method Summary collapse
Instance Method Details
#find_ids(records_or_ids) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/db_memoize/helpers.rb', line 7 def find_ids(records_or_ids) records_or_ids = Array(records_or_ids) return [] if records_or_ids.empty? records_or_ids.first.is_a?(ActiveRecord::Base) ? records_or_ids.map(&:id) : records_or_ids end |