method

find_sole_by

rails latest stable - Class: ActiveRecord::FinderMethods
find_sole_by(arg, *args)
public

Finds the sole matching record. Raises ActiveRecord::RecordNotFound if no record is found. Raises ActiveRecord::SoleRecordExceeded if more than one record is found.

Product.find_sole_by(["price = %?", price])