class method self.find_from_ids

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18 Private

Available in: v2.2.3 v2.3.18

Signature

self.find_from_ids(ids, options)

No documentation comment.

Parameters

ids req
options req
Source
# File activerecord/lib/active_record/base.rb, line 1593
        def find_from_ids(ids, options)
          expects_array = ids.first.kind_of?(Array)
          return ids.first if expects_array && ids.first.empty?

          ids = ids.flatten.compact.uniq

          case ids.size
            when 0
              raise RecordNotFound, "Couldn't find #{name} without an ID"
            when 1
              result = find_one(ids.first, options)
              expects_array ? [ result ] : result
            else
              find_some(ids, options)
          end
        end

Defined in activerecord/lib/active_record/base.rb line 1593 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close