ActiveRecord: where, find

The where method for an ActiveRecord returns an ActiveRecord::Relation which behaves like an Array for some operations, but is not one.

It returns an array so if you want a single item (say with id = 3) either use:



YourModel.where(“id = 3”).first

More here:

Leave a Reply

Your email address will not be published. Required fields are marked *