https://github.com/radar/find_by_hash
Extension to ActiveRecord to allow you to do findy-thingies with hashes
https://github.com/radar/find_by_hash
Last synced: 2 months ago
JSON representation
Extension to ActiveRecord to allow you to do findy-thingies with hashes
- Host: GitHub
- URL: https://github.com/radar/find_by_hash
- Owner: radar
- License: mit
- Created: 2010-01-12T08:44:42.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-07-03T05:10:32.000Z (almost 15 years ago)
- Last Synced: 2025-02-28T06:58:04.119Z (3 months ago)
- Language: Ruby
- Homepage: http://frozenplague.net
- Size: 97.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# Find By Hash
Find By Hash is a library that does exactly what it says on the box: it finds by a Hash. It will improve all aspects of your life.
All methods require a hash to be passed to them, otherwise you'll get a `NotAHash` error.
## `find_by_hash`
Finds a single record based on the given hash.
Post.find_by_hash(:title => "Hey there!")
## `find_all_by_hash`
Finds all records based on the given hash.
Post.find_all_by_hash(:title => "Hey there!")
## `find_or_create_by_hash`Finds or creates a record based on the given hash.
Post.find_or_create_by_hash(:title => "Hey there!")
## `find_or_initialize_by_hash`Finds or initializes a record based on the given hash.
Post.find_or_initialize_by_hash(:title => "Hey there!")