No release in over 3 years
Low commit activity in last 3 years
Provides find_only and find_only! query methods
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0
~> 3.0
~> 1.3.6

Runtime

 Project Readme

ActiveRecord::FindOnly

Provides the #find_only and #find_only! methods for querying ActiveRecord objects.

#find_only - returns the only record that meets the criteria. If no records match the criteria, nil is returned. Raises TooManyRecords if more than one records matches the criteria.

#find_only! - returns the only record that meets the criteria. If no records match the criteria, RecordNotFound is raised. Raises TooManyRecords if more than one records matches the criteria.

Installation

Add this line to your application's Gemfile:

gem 'active_record-find_only'

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_record-find_only

Usage

See the spec files for example usage.

License

The gem is available as open source under the terms of the MIT License.