method

find_some

Importance_2
v1.1.6 - Show latest stable - 3 notes - Class: ActiveRecord::Base
find_some(ids, options) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
February 13, 2009
1 thank

throws exception

when use use Model.find([1,2,3,4])

throws exception if no record exists with any of this ID

November 3, 2010
1 thank

correction

I think what metavida meant was

User.find(1, 3) # ActiveRecord::RecordNotFound error

not

User.find_by_id(1, 3) # this will just return user 1
November 3, 2010
0 thanks

RecordNotFound when any id not found

As an example of bansalakhil’s explanation.

User.find_by_id(1) #=> #<User:0x3d54a3c @attributes={"id"=>1}>
User.find_by_id(2) #=> #<User:0x3d519a4 @attributes={"id"=>2}>
User.find_by_id(3) #=> nil
User.find_by_id(1, 2) #=> an Array with 2 User instances
User.find_by_id(1, 3) #=> an ActiveRecord::RecordNotFound error