Sha256: 61d47296076d4672dbb8242702f7f9b99e12bc3647c09cc1340497ad32918aaa
Contents?: true
Size: 966 Bytes
Versions: 2
Compression:
Stored size: 966 Bytes
Contents
# MongoidFindBy [![Build Status](https://secure.travis-ci.org/tbpro/mongoid_find_by.png)](https://travis-ci.org/tbpro/mongoid_find_by) [![Code Climate](https://codeclimate.com/github/tbpro/mongoid_find_by.png)](https://codeclimate.com/github/tbpro/mongoid_find_by) MongoidFindBy adds simple functions to mongoid documents to find documents by dynamic fields. ## Install ```ruby gem 'mongoid_find_by' ``` ## Usage ```ruby class Person include Mongoid::Document include Mongoid::FindBy field :name, :type => String end ``` ```ruby # returns a single document Person.find_by_name('Thomas') Person.find_first_by_name('Thomas') Person.find_last_by_name('Thomas') # returns a document collection Person.find_all_by_name('Thomas') # throws Mongoid::Errors::DocumentNotFound # exception for non existent documents Person.find_by_name!('Thomas) ``` ## Credits Copyright (c) 2012-2013 Thomas Boerger Programmierung <http://www.tbpro.de>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongoid_find_by-0.1.3 | README.md |
mongoid_find_by-0.1.2 | README.md |