Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elcuervo/ohm-find_by
find_by to Ohm::Model
https://github.com/elcuervo/ohm-find_by
Last synced: 30 days ago
JSON representation
find_by to Ohm::Model
- Host: GitHub
- URL: https://github.com/elcuervo/ohm-find_by
- Owner: elcuervo
- License: other
- Created: 2010-11-25T19:18:53.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-05-06T12:20:41.000Z (over 13 years ago)
- Last Synced: 2024-04-26T19:22:10.931Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 102 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ohm-find_by
This is just a fast implementation of AR find_by_{attr} for Ohm
class Post < Ohm::Model
attribute :name
attribute :authorindex :name
endWith that Ohm::Model in mind now you can do this:
Post.create :name => "My first Post", :author => "elCuervo"
=> #
Post.find_by_name "My first Post"
=> #Also checks the existence of the index before searching so:
Post.find_by_author "elCuervo"
=> Ohm::Model::IndexNotFound## Note on Patches/Pull Requests
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.